mirror of
https://github.com/python/cpython.git
synced 2026-02-21 22:50:55 +00:00
gh-141563: Don't test datetime.h with the limited C API (#144673)
Fix test_cext and test_cppext.
This commit is contained in:
parent
3dadc22a27
commit
23d45f0c24
2 changed files with 6 additions and 0 deletions
|
|
@ -54,10 +54,13 @@ _testcext_add(PyObject *Py_UNUSED(module), PyObject *args)
|
|||
static PyObject *
|
||||
test_datetime(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
|
||||
{
|
||||
// datetime.h is excluded from the limited C API
|
||||
#ifndef Py_LIMITED_API
|
||||
PyDateTime_IMPORT;
|
||||
if (PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,10 +232,13 @@ test_virtual_object(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
|
|||
static PyObject *
|
||||
test_datetime(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
|
||||
{
|
||||
// datetime.h is excluded from the limited C API
|
||||
#ifndef Py_LIMITED_API
|
||||
PyDateTime_IMPORT;
|
||||
if (PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue