-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
PyImport_ExecCodeModuleObject not setting module attributes #65425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In Python/import.c, PyImport_ExecCodeModuleObject creates a new module object but doesn't set all of the attributes required for modules, such as __spec__ or __loader__. This breaks mod_wsgi from 3.3 and up, which depends on PyImport_ExecCodeModuleEx, which delegates to PyImport_ExecCodeModuleObject for its module creation logic. See https://code.google.com/p/modwsgi/source/browse/mod_wsgi/mod_wsgi.c#6289 |
Here's a (currently segfaulting) patch that demonstrates how I'd like to solve this. Feedback on the approach is welcome. :) When I get a chance I'll debug the segfault. |
The last argument to _PyObject_CallMethodIdObjArgs needs to be NULL... |
Thanks, Benjamin. Here's an updated patch that passes all tests. It should be good to go. And yet again our zipimport implementation was a pain point. :( |
LGTM although you forgot to use a loader instance instead of the class. |
New changeset 7d20e30bd540 by Eric Snow in branch '3.4': New changeset bc324a49d0fc by Eric Snow in branch 'default': |
New changeset baa7b5555656 by Eric Snow in branch '3.4': New changeset 57130574d1e8 by Eric Snow in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: