Conversation
…nitfunc() The builtin loader info encoded the module name as ASCII, so a non-ASCII spec name failed with UnicodeEncodeError even for multi-phase init modules, which support such names when loaded dynamically. Fall back to UTF-8 and mark the name as non-ASCII, so that multi-phase init works and single-phase init is rejected with the same error as for dynamically loaded extensions. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HoZE3WdRWQshvinfBZ137N
|
Out of curiosity (and to inform future prioritization), did this actually come up in practice?
As a nitpick, |
no, this didn't come up in the real world, it was something claude flagged while looking into the single-phase init issue. I don't feel strongly about this fix, if you think it's not worth it, we can drop it. |
The builtin loader info encoded the module name as ASCII, so a non-ASCII spec name failed with UnicodeEncodeError even for multi-phase init modules, which support such names when loaded dynamically. Fall back to UTF-8 and mark the name as non-ASCII, so that multi-phase init works and single-phase init is rejected with the same error as for dynamically loaded extensions.
AI assisted with Claude Fable 5.1
PyImport_CreateModuleFromInitfunc(): wrong__name__for submodules, non-ASCII names rejected, inittab name clashes #157384