gh-117953: Track Extra Details in Global Extensions Cache (gh-118532)

We have only been tracking each module's PyModuleDef.  However, there are some problems with that.  For example, in some cases we load single-phase init extension modules from def->m_base.m_init or def->m_base.m_copy, but if multiple modules share a def then we can end up with unexpected behavior.

With this change, we track the following:

* PyModuleDef (same as before)
* for some modules, its init function or a copy of its __dict__, but specific to that module
* whether it is a builtin/core module or a "dynamic" extension
* the interpreter (ID) that owns the cached __dict__ (only if cached)

This also makes it easier to remember the module's kind (e.g. single-phase init) and if loading it previously failed, which I'm doing separately.
This commit is contained in:
Eric Snow 2024-05-04 15:24:02 -06:00 committed by GitHub
parent 978fba58ae
commit 291cfa454b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 577 additions and 137 deletions

File diff suppressed because it is too large Load diff