rexec, threads, and ugly crashes

Danyel Fisher danyelf at ics.uci.edu
Fri Apr 20 13:59:03 EDT 2001


Thanks for the response.

> Is this a regular Python application, started by invoking the
> interpreter with a script, or is it an application with an embedded
> interpreter?

It's a regular python application.

>   DF> RExec is my tool.
> I don't think the problem is related to rexec.

It might not be. But that line is the one where it
crashes, each time: before it's even had a chance
to look at the RExec'd code.

> The error message means that a C extension module is being loaded
> before Py_Initialize() has been called.  Py_Initialize() is called in
> Py_Main() pretty much before it does anything else.

Odd. I take it that generating a new interpreter--with rexec--
is what creates a new module?

[Other possibly-relevant details: I'm doing this within a
thread started by a SocketServer with the Threading MixIn,
using TCPServer. I'll work on putting together a minimum set
of code that hits the crash later.]

> What happens if you just type
> bash-2.04$ python -v -c "import imp"

It seems to work fine, I think:

bash-2.04$ python -v -c "import imp"
# /usr/local/lib/python2.0/site.pyc matches /usr/local/lib/python2.0/site.py
import site # precompiled from /usr/local/lib/python2.0/site.pyc
# /usr/local/lib/python2.0/os.pyc matches /usr/local/lib/python2.0/os.py
import os # precompiled from /usr/local/lib/python2.0/os.pyc
import posix # builtin
# /usr/local/lib/python2.0/posixpath.pyc matches
/usr/local/lib/python2.0/posixpath.py
import posixpath # precompiled from /usr/local/lib/python2.0/posixpath.pyc
# /usr/local/lib/python2.0/stat.pyc matches /usr/local/lib/python2.0/stat.py
import stat # precompiled from /usr/local/lib/python2.0/stat.pyc
# /usr/local/lib/python2.0/UserDict.pyc matches
/usr/local/lib/python2.0/UserDict.py
import UserDict # precompiled from /usr/local/lib/python2.0/UserDict.pyc
Python 2.0 (#4, Apr 11 2001, 12:50:56)
[GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
Type "copyright", "credits" or "license" for more information.
import imp # builtin
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] exceptions
# cleanup[1] posix
# cleanup[1] imp
# cleanup[1] site
# cleanup[1] signal
# cleanup[2] os.path
# cleanup[2] os
# cleanup[2] UserDict
# cleanup[2] posixpath
# cleanup[2] stat
# cleanup sys
# cleanup __builtin__
# cleanup ints
# cleanup floats





More information about the Python-list mailing list