STINNER Victor <vstin...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue42979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to