From 6bb1d885c696914e5900329c3d0b6bf2bfefee81 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Tue, 11 May 2021 23:35:39 -0700 Subject: [PATCH] time: fix constants availability (#5419) --- stdlib/time.pyi | 23 +++++++++++++--------- tests/stubtest_whitelists/darwin-py310.txt | 1 + tests/stubtest_whitelists/darwin-py37.txt | 3 ++- tests/stubtest_whitelists/darwin-py38.txt | 3 ++- tests/stubtest_whitelists/darwin-py39.txt | 1 + 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/stdlib/time.pyi b/stdlib/time.pyi index 5d9c0148e..6e926c68d 100644 --- a/stdlib/time.pyi +++ b/stdlib/time.pyi @@ -13,23 +13,28 @@ daylight: int timezone: int tzname: Tuple[str, str] -if sys.version_info >= (3, 7) and sys.platform != "win32": +if sys.version_info >= (3, 7): if sys.platform == "linux": CLOCK_BOOTTIME: int - CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD - CLOCK_UPTIME: int # FreeBSD, OpenBSD + if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": + CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD + CLOCK_UPTIME: int # FreeBSD, OpenBSD if sys.version_info >= (3, 3) and sys.platform != "win32": - CLOCK_HIGHRES: int # Solaris only - CLOCK_MONOTONIC: int # Unix only - CLOCK_MONOTONIC_RAW: int # Linux 2.6.28 or later - CLOCK_PROCESS_CPUTIME_ID: int # Unix only - CLOCK_REALTIME: int # Unix only - CLOCK_THREAD_CPUTIME_ID: int # Unix only + CLOCK_MONOTONIC: int + CLOCK_MONOTONIC_RAW: int + CLOCK_PROCESS_CPUTIME_ID: int + CLOCK_REALTIME: int + CLOCK_THREAD_CPUTIME_ID: int + if sys.platform != "linux" and sys.platform != "darwin": + CLOCK_HIGHRES: int # Solaris only if sys.version_info >= (3, 8) and sys.platform == "darwin": CLOCK_UPTIME_RAW: int +if sys.version_info >= (3, 9) and sys.platform == "linux": + CLOCK_TAI: int + class _struct_time(NamedTuple): tm_year: int tm_mon: int diff --git a/tests/stubtest_whitelists/darwin-py310.txt b/tests/stubtest_whitelists/darwin-py310.txt index dc20561ce..d86b21728 100644 --- a/tests/stubtest_whitelists/darwin-py310.txt +++ b/tests/stubtest_whitelists/darwin-py310.txt @@ -1,3 +1,4 @@ +_?curses.A_ITALIC _curses.color_pair curses.color_pair time.CLOCK_PROF diff --git a/tests/stubtest_whitelists/darwin-py37.txt b/tests/stubtest_whitelists/darwin-py37.txt index 5043392b3..89807a2b1 100644 --- a/tests/stubtest_whitelists/darwin-py37.txt +++ b/tests/stubtest_whitelists/darwin-py37.txt @@ -1,4 +1,5 @@ +_?curses.A_ITALIC ctypes.wintypes pwd.getpwnam time.CLOCK_PROF -time.CLOCK_UPTIME \ No newline at end of file +time.CLOCK_UPTIME diff --git a/tests/stubtest_whitelists/darwin-py38.txt b/tests/stubtest_whitelists/darwin-py38.txt index 8b12bd639..8bf6f2e28 100644 --- a/tests/stubtest_whitelists/darwin-py38.txt +++ b/tests/stubtest_whitelists/darwin-py38.txt @@ -1,2 +1,3 @@ +_?curses.A_ITALIC time.CLOCK_PROF -time.CLOCK_UPTIME \ No newline at end of file +time.CLOCK_UPTIME diff --git a/tests/stubtest_whitelists/darwin-py39.txt b/tests/stubtest_whitelists/darwin-py39.txt index 74a735d0c..8bf6f2e28 100644 --- a/tests/stubtest_whitelists/darwin-py39.txt +++ b/tests/stubtest_whitelists/darwin-py39.txt @@ -1,2 +1,3 @@ +_?curses.A_ITALIC time.CLOCK_PROF time.CLOCK_UPTIME