◐ Shell
clean mode source ↗

Message 60301 - Python tracker

There are too many different C-level APIs for importing
a module.

Many of them have the nasty property that they can try
to do a relative import in the context of the nearest
Python stack frame, where that is not what the C code
intended.

This needs to be cleaned up.

Example use case: time.strptime() is now a C wrapper
that imports the _strptime module; but if you follow
the path it takes to import, it's quite an amazing
journey. It should cut all of that short by looking in
sys.modules['_strptime'] first. (But what about
restricted execution? Well _strptime.py ought to be safe.)