New submission from STINNER Victor <[email protected]>:
_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().
----------
components: Extension Modules
messages: 385355
nosy: vstinner
priority: normal
severity: normal
status: open
title: _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT
failure
versions: Python 3.10
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com