mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #22117: Add a new _PyTime_FromSeconds() function
Fix also _Py_InitializeEx_Private(): initialize time before initializing import, import_init() uses the _PyTime API (for thread locks).
This commit is contained in:
parent
21dfffa218
commit
13019fdef3
6 changed files with 45 additions and 5 deletions
|
@ -731,6 +731,13 @@ class TestPytime(unittest.TestCase):
|
|||
@unittest.skipUnless(_testcapi is not None,
|
||||
'need the _testcapi module')
|
||||
class TestPyTime_t(unittest.TestCase):
|
||||
def test_FromSeconds(self):
|
||||
from _testcapi import PyTime_FromSeconds
|
||||
for seconds in (0, 3, -456, _testcapi.INT_MAX, _testcapi.INT_MIN):
|
||||
with self.subTest(seconds=seconds):
|
||||
self.assertEqual(PyTime_FromSeconds(seconds),
|
||||
seconds * SEC_TO_NS)
|
||||
|
||||
def test_FromSecondsObject(self):
|
||||
from _testcapi import PyTime_FromSecondsObject
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue