Repository navigation
Conversation
…) semantics Document that single-phase init modules are added to sys.modules by the call itself (unlike multi-phase init modules), and that the spec name identifies the module, so a later call with the same name and a different init function reuses the cached module without calling the new init function. Add regression tests for both behaviors. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HoZE3WdRWQshvinfBZ137N
Documentation build overview
147 files changed ·
|
|
Could you turn “legacy single-phase initialization” into a link? (And remove the parenthesis -- Also, please link the “as is done for”/“as for” parts -- the docs for the mentioned feature should explain what happens in more detail; if they don't then the mention isn't very useful. The existing docs already point out that the init function is not called twice. It would be nice to clarify there what the “lookup key“ is when determining subsequent imports of the “same” module. |
|
Done, thanks for the suggestions @encukou ! |
|
I'll rebase, and reword a bit. |
|
@itamaro, how's this look? |
Thanks @encukou , this reads much better than what I had! the merge looks good too. should we make the collision case more accurate? in two places ( possible changes:
and for another nit: "reuses the previous module's contents" is only accurate for happy to push the changes if you'd like. |
|
Hm, right. I guess it makes sense to document this, especially since it's soft-deprecated and thus should not change. I still left out the subinterpreter-specific behaviour, saying it could go either way. Does this look good? Please feel free to push directly, it's your PR :) |
Document that single-phase init modules are added to sys.modules by the call itself (unlike multi-phase init modules), and that the spec name identifies the module, so a later call with the same name and a different init function reuses the cached module without calling the new init function. Add regression tests for both behaviors.
AI assisted with Claude Fable 5.1
PyImport_CreateModuleFromInitfunc(): wrong__name__for submodules, non-ASCII names rejected, inittab name clashes #157384