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
Py_NewInterpreter does not work #47973
Comments
The example Demo/embed/importexc.c crashes, because Py_NewInterpreter (the "import exceptions" statement does not work with python 3.0, but I tried to put "-1" in the m_size structure of these modules, and they I think that these modules should be made re-importable, with specific Maybe two related problems:
|
Maybe, I'm not seeing the whole problem, but can't we just add |
I applied the patch to PC/config.c, but this did not change anything. |
Interesting, here it lets import.c's init_builtin reinitalize modules... |
Adding the functions as initfunc in module init table is of no use as One thing that does appear to work, although no idea of whether it is Attached diff shows nature of changes. Diff is bit messy as have left Maybe this will give someone who knows how overall interpreter At least with change as is, mod_wsgi works for sub interpreters now. |
Your patch may go in the right direction, but please provide only |
Argh. Personally I like to provide context diff's but more often than not |
Unified diff now attached. |
Here is a patch that fixed importexc.c. It consists of the following parts:
|
I think the patch goes in the right direction. But in addition, Py_NewInterpreter() has to call initstdio() between initmain() and initsite() (the same sequence as in Py_InitializeEx) |
Wouldn't it make more sense to move interpreter initialization things to |
Sounds like a good plan, Benjamin |
Can you propose a specific patch? I'm worried that doing so blindly |
The patch "subinterpreter.patch" is based on Martin's patch $ rm -f Demo/embed/importexc.o; cd Demo/embed; make; ./importexc; cd ../..
gcc -g -I../../Include -I../.. -c -o importexc.o importexc.c
gcc -Xlinker -export-dynamic importexc.o ../../libpython3.0.a -lnsl
-ldl -lreadline -ltermcap -lieee -lpthread -lutil -lm -o importexc
Initialize interpreter
<module 'types' from '/usr/local/lib/python3.0/types.py'> Initialize subinterpreter
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "/usr/local/lib/python3.0/encodings/__init__.py", line 32, in
<module>
ValueError: Cannot encode path item
Aborted |
In combination with the patch in bpo-4213, "subinterpreter.patch" fixes the I'm assigning the bug to Barry for his final decision. |
In conjunction with bpo-4213, the attached subinterpreter.patch appears to |
Applied in r67057 |
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: