Skip to content
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() doesn't work #37776

Closed
geertj mannequin opened this issue Jan 15, 2003 · 5 comments
Closed

Py_NewInterpreter() doesn't work #37776

geertj mannequin opened this issue Jan 15, 2003 · 5 comments

Comments

@geertj
Copy link
Mannequin

geertj mannequin commented Jan 15, 2003

BPO 668708
Nosy @loewis

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:

assignee = None
closed_at = <Date 2003-01-22.09:33:26.000>
created_at = <Date 2003-01-15.20:17:50.000>
labels = []
title = "Py_NewInterpreter() doesn't work"
updated_at = <Date 2003-01-22.09:33:26.000>
user = 'https://bugs.python.org/geertj'

bugs.python.org fields:

activity = <Date 2003-01-22.09:33:26.000>
actor = 'loewis'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2003-01-15.20:17:50.000>
creator = 'geertj'
dependencies = []
files = []
hgrepos = []
issue_num = 668708
keywords = []
message_count = 5.0
messages = ['14087', '14088', '14089', '14090', '14091']
nosy_count = 3.0
nosy_names = ['loewis', 'geertj', 'joshhoyt']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue668708'
versions = ['Python 2.3']

@geertj
Copy link
Mannequin Author

geertj mannequin commented Jan 15, 2003

Hello,

mod_python doesn't seem to work with Python 2.3a1.
After some debugging, it seems the culprit is
Py_NewInterpreter(). The following C program works with
Python 2.2 but gives an error with Python 2.3:

#include <Python.h>

int main()
{
    PyThreadState *tstate; 
    Py_Initialize();
    tstate = Py_NewInterpreter();
    return 0;
}

The relevant part of this program's output:

geertj@cristina:~$ PYTHONVERBOSE=1 ./a.out
# installing zipimport hook
import zipimport # builtin
[...]
import __builtin__ # previously loaded (builtin)
import sys # previously loaded (sys)
'import site' failed; traceback:
ImportError: No module named site

It seems that Python is unable to find the module "site".

Greetings,
Geert Jansen

@geertj geertj mannequin closed this as completed Jan 15, 2003
@geertj geertj mannequin closed this as completed Jan 15, 2003
@geertj
Copy link
Mannequin Author

geertj mannequin commented Jan 15, 2003

Logged In: YES
user_id=537938

I forgot to mention that the Python version used is 2.3a1.

Geert Jansen

@joshhoyt
Copy link
Mannequin

joshhoyt mannequin commented Jan 20, 2003

Logged In: YES
user_id=693077

The problem appears to be that meta_path is not being
initialized in the new interpreter. Adding
_PyImportHooks_Init to Py_NewInterpreter seems to fix the
problem, initializing the new import hooks before trying to
import modules into the new interpreter.

@joshhoyt
Copy link
Mannequin

joshhoyt mannequin commented Jan 20, 2003

Logged In: YES
user_id=693077

Patch 671459 seems to fix the problem.

@loewis
Copy link
Mannequin

loewis mannequin commented Jan 22, 2003

Logged In: YES
user_id=21627

This was indeed fixed with that patch.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants