Nick Coghlan added the comment:
Core dev forum thread for the C API question:
https://discuss.python.org/t/subtle-c-api-discrepancy-pyeval-getlocals-vs-pyeval-getglobals-with-no-python-frame/14797
--
___
Python tracker
New submission from Nick Coghlan :
While working on the first PR for bpo-44800 I provoked an obscure failure in
PyImport_ImportModule by making PyEval_GetGlobals set an exception when
returning NULL (as PyEval_GetLocals has done since bpo-18408 was implemented
for Python 3.4).
This ticket