Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Lib/test/test_cext/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_cppext/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading