This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2021-01-20.17:26:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611163566.26.0.253539458839.issue42979@roundup.psfhosted.org>
In-reply-to
Content
_zoneinfo starts with:

static int
zoneinfomodule_exec(PyObject *m)
{
    PyDateTime_IMPORT;

with:

#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI"
#define PyDateTime_IMPORT \
    PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0)

If PyCapsule_Import() fails, zoneinfomodule_exec() returns 0 (success) with an exception raised.

It should check if the import succeeded or not. Concrete example on AIX where datetime cannot be imported:
https://bugs.python.org/issue42604#msg385347

"./python setup.py build" fails with:

Assertion failed: (item != NULL) ^ (PyErr_Occurred() != NULL), file  Objects/abstract.c, line 163

--

By the way, the import machinery should raise a SystemError if a module exec function raises an exception *and* reports a success: see _Py_CheckFunctionResult().
History
Date User Action Args
2021-01-20 17:26:06vstinnersetrecipients: + vstinner
2021-01-20 17:26:06vstinnersetmessageid: <1611163566.26.0.253539458839.issue42979@roundup.psfhosted.org>
2021-01-20 17:26:06vstinnerlinkissue42979 messages
2021-01-20 17:26:06vstinnercreate