Skip to content

Commit 427a490

Browse files
kulikjakasvetlov
andauthored
bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent 6fc91da commit 427a490

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Lib/test/test_time.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ def test_pthread_getcpuclockid(self):
117117
clk_id = time.pthread_getcpuclockid(threading.get_ident())
118118
self.assertTrue(type(clk_id) is int)
119119
# when in 32-bit mode AIX only returns the predefined constant
120-
if not platform.system() == "AIX":
121-
self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
122-
elif (sys.maxsize.bit_length() > 32):
123-
self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
124-
else:
120+
if platform.system() == "AIX" and (sys.maxsize.bit_length() <= 32):
125121
self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
122+
# Solaris returns CLOCK_THREAD_CPUTIME_ID when current thread is given
123+
elif sys.platform.startswith("sunos"):
124+
self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
125+
else:
126+
self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
126127
t1 = time.clock_gettime(clk_id)
127128
t2 = time.clock_gettime(clk_id)
128129
self.assertLessEqual(t1, t2)

0 commit comments

Comments
 (0)