FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40280: Detect presence of time.tzset and thread_time clock (GH-31898) by tiran · Pull Request #31898 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .py  (3) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
3 changes: 3 additions & 0 deletions Lib/test/datetimetester.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5856,6 +5856,9 @@ def test_gaps(self):
ldt = tz.fromutc(udt.replace(tzinfo=tz))
self.assertEqual(ldt.fold, 0)

@unittest.skipUnless(
hasattr(time, "tzset"), "time module has no attribute tzset"
)
def test_system_transitions(self):
if ('Riyadh8' in self.zonename or
# From tzdata NEWS file:
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_strptime.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ def test_timezone(self):
"LocaleTime().timezone has duplicate values and "
"time.daylight but timezone value not set to -1")

@unittest.skipUnless(
hasattr(time, "tzset"), "time module has no attribute tzset"
)
def test_bad_timezone(self):
# Explicitly test possibility of bad timezone;
# when time.tzname[0] == time.tzname[1] and time.daylight
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_time.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,9 @@ def test_get_clock_info(self):
'perf_counter',
'process_time',
'time',
'thread_time',
]
if hasattr(time, 'thread_time'):
clocks.append('thread_time')

for name in clocks:
with self.subTest(name=name):
Expand Down
4 changes: 3 additions & 1 deletion Modules/timemodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,9 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
return 0;
}

#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
#elif defined(HAVE_CLOCK_GETTIME) && \
defined(CLOCK_PROCESS_CPUTIME_ID) && \
!defined(__EMSCRIPTEN__)
#define HAVE_THREAD_TIME

#if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)
Expand Down

Back | FazBrowse Home | New Git URL