[New-bugs-announce] [issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure
STINNER Victor
report at bugs.python.org
Wed Jan 20 12:26:06 EST 2021
New submission from STINNER Victor <vstinner at python.org>:
_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 <report at bugs.python.org>
<https://bugs.python.org/issue42979>
_______________________________________
More information about the New-bugs-announce
mailing list