You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inittab modules in packages hit an assertion since Python 3.13 #140011
This works fine when using a CPython build with assertions disabled, and also works fine with Python 3.12 with assertions enabled.
Since Python 3.13 (and still true on main), importing a dotted-inittab-module in an assertions-enabled build hits a new assertion (added in gh-118204):
Assertion failed: (PyUnicode_FindChar(name, '.', 0, PyUnicode_GetLength(name), -1) == -1), function _Py_ext_module_loader_info_init_for_builtin, file importdl.c, line 178.
It is unclear to me whether it was intentional to make dotted-inittab-modules "not supported", or it was unintended consequence.
The docs don't mention such a limitation when using inittab, and at least as of gh-102700, explicit support for this scenario was added in Python 3.12 and backported to 3.11.
I created a demo repo to demonstrate the issue, with several PRs against it demonstrating that it works with assertions disabled and in 3.12 with assertions enabled.
Activity
itamaro commentedon Oct 12, 2025
cc @ericsnowcurrently as the author of gh-118204
Workaround assertion with Native Python extensions in packages
Merge branch 'main' into pythongh-140011-dotted-import
gh-140011: Delete importdl assertion that prevents importing embedded…
pythongh-140011: Delete importdl assertion that prevents importing em…
pythongh-140011: Delete importdl assertion that prevents importing em…
[3.14] gh-140011: Delete importdl assertion that prevents importing e…
[3.13] gh-140011: Delete importdl assertion that prevents importing e…
pythongh-140011: Delete importdl assertion that prevents importing em…
pythongh-140011: Delete importdl assertion that prevents importing em…