diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-04-03 13:10:54 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-04-03 13:10:54 +0200 |
commit | e5a1ccdc5648669a45fd37781f99b022bdd1dd52 (patch) | |
tree | abc631f6077629220545c2c606b2beaad6ef0f68 /Modules/_testcapimodule.c | |
parent | 2b319199ff5ba48ce7ebf0816241623538f6923e (diff) | |
download | cpython-e5a1ccdc5648669a45fd37781f99b022bdd1dd52.tar.gz |
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).
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 7b4f239637..d6eb6d4509 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -3383,6 +3383,18 @@ return_result_with_error(PyObject *self, PyObject *args) } static PyObject * +test_pytime_fromseconds(PyObject *self, PyObject *args) +{ + int seconds; + _PyTime_t ts; + + if (!PyArg_ParseTuple(args, "i", &seconds)) + return NULL; + ts = _PyTime_FromSeconds(seconds); + return _PyTime_AsNanosecondsObject(ts); +} + +static PyObject * test_pytime_fromsecondsobject(PyObject *self, PyObject *args) { PyObject *obj; @@ -3651,6 +3663,7 @@ static PyMethodDef TestMethods[] = { return_null_without_error, METH_NOARGS}, {"return_result_with_error", return_result_with_error, METH_NOARGS}, + {"PyTime_FromSeconds", test_pytime_fromseconds, METH_VARARGS}, {"PyTime_FromSecondsObject", test_pytime_fromsecondsobject, METH_VARARGS}, {"PyTime_AsSecondsDouble", test_pytime_assecondsdouble, METH_VARARGS}, {"PyTime_AsTimeval", test_PyTime_AsTimeval, METH_VARARGS}, |