Uh oh!
There was an error while loading. Please reload this page.
gh-140011: Delete importdl assertion that prevents importing embedded modules from packages - #141605
Conversation
with this, test_embed fails with ``` Assertion failed: (PyUnicode_FindChar(name, '.', 0, PyUnicode_GetLength(name), -1) == -1), function _Py_ext_module_loader_info_init_for_builtin, file importdl.c, line 159. ```
with this, test_embed succeeds again
encukou
commented
Nov 17, 2025
It was added in #118204 @ericsnowcurrently, do you remember if there was a reason for this assert? @itamaro: I'd be a bit more careful in Could you add a different containing package to the inittab? |
itamaro
commented
Nov 18, 2025
Can Regardless, I agree this is an awkward way to test this. I think it would make more sense to add a net new test case for this functionality, if we decide it's a desired functionality we don't want to regress. |
encukou
commented
Nov 18, 2025
I'd say that as an embedder, you're probably in the best position both to test this, and to decide if it's desired functionality. Allowing submodules in inittab looks doable. (@brettcannon, do you have any thoughts on Allowing packages, on the other hand, might be worth more discussion -- that would probably need new API, since
It can! Not sure if it's meaningful to run it without the test package available, but I do use the CLI on its own when debugging. Anyway that's not the question to ask. More coupling bad, self-contained good :) |
itamaro
commented
Nov 19, 2025
thanks @encukou |
brettcannon
commented
Nov 19, 2025
I think it's fine to add. I suspect it didn't have it just because the need never came up. |
This reverts commit 4949865.
covering both single-phase init and multi-phase init embedded extensions
itamaro
commented
Nov 23, 2025
@encukou I added new dedicated tests |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
encukou
commented
Nov 26, 2025
Looks good, thank you! |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, @itamaro and @encukou, I could not cleanly backport this to |
Sorry, @itamaro and @encukou, I could not cleanly backport this to |
…bedded modules from packages (pythonGH-141605) (cherry picked from commit 27f62eb)
GH-141986 is a backport of this pull request to the 3.14 branch. |
…bedded modules from packages (pythonGH-141605) (cherry picked from commit 27f62eb)
GH-141987 is a backport of this pull request to the 3.13 branch. |
…bedded modules from packages (pythonGH-141605)
…bedded modules from packages (pythonGH-141605)
I still don't know what's the context behind this assertion, just that I didn't see any issues from removing it.