Something changed recently, and now the Demo/embed programs are broken, e.g.
% ./loop pass 2 Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 'import site' failed; use -v for traceback Segmentation fault (core dumped)
The crash is happening in the second call to init_exceptions()
(gdb) where #0 PyModule_GetDict (m=0x0) at Objects/moduleobject.c:40 #1 0x8075ea8 in init_exceptions () at Python/exceptions.c:1058 #2 0x8051880 in Py_Initialize () at Python/pythonrun.c:147 #3 0x80516db in main (argc=3, argv=0xbffffa34) at loop.c:28
because the attempt to import __builtin__ returns NULL. I don't have time right now to look any deeper, but I suspect that the crash may be due to changes in the semantics of PyImport_ImportModule() which now goes through __import__.
I'm posting this in case someone with spare cycles can look at it.
-Barry
This was probably broken since PyImport_Import() was introduced in 1997! The code in PyImport_Import() tried to save itself a bit of work and save the __builtin__ module in a static variable. But this doesn't work across Py_Finalise()/Py_Initialize()! It also doesn't work when using multiple interpreter states created with PyInterpreterState_New(). So I'm ripping out this code. Looks like it's passing the test suite so I'm checking in the patch. It looks like we need a much more serious test suite for multiple interpreters and repeatedly initializing! --Guido van Rossum (home page: http://www.python.org/~guido/)