Stefan Krah <ste...@bytereef.org> added the comment:

Actually I just see that this behavior of PyImport_GetModule() is documented:

"Return the already imported module with the given name. If the module has not 
been imported yet then returns NULL but does not set an error. Returns NULL and 
sets an error if the lookup failed."

New in version 3.7.


So it should indeed be just a matter of always checking for PyErr_Occurred().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36370>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to