[issue42979] _zoneinfo: zoneinfomodule_exec() doesn't check for PyDateTime_IMPORT failure

STINNER Victor report at bugs.python.org
Wed Jan 27 05:28:15 EST 2021


STINNER Victor <vstinner at python.org> added the comment:

Thanks for the fix Hai Shi!

> 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().

It's already the case. Example:

>>> import _zoneinfo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: execution of module _zoneinfo raised unreported exception

With this bug:

diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index d0c462fb86..fc564b9587 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -2683,6 +2683,7 @@ zoneinfomodule_exec(PyObject *m)
         goto error;
     }
 
+    PyErr_SetString(PyExc_Exception, "BUG");
     return 0;
 
 error:

----------
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42979>
_______________________________________


More information about the Python-bugs-list mailing list