pdb with multithreads & PyEval_CallObject

Immanuel immanuel at yours.com
Wed Mar 21 11:56:07 EST 2001


I apologize if this is a repost...but my previous posting did make it to the
newsgroup.

I have a Linux multi-threaded application which both extend & embed Python.
The threads are created in C++, and the entry point of the application is
started via
Python; one of these threads, however, have a PyEval_CallObject in it. Since
I need
to acquire the interpreter lock before calling PyEval_CallObject, this means
that pdb
is unable to break at the callback function. Does anyone know how to get
around this?
The alternative to debugging this is, of course, good old prints.

Thanks.
  Immanuel

Code snippet:

=======================
"main" python thread:

def cbfunc(arg):
    # callback func
    ...

app.start()         # threads created
app.installCallback(cbfunc)
...

=======================
"embedded" thread:
tstate = PyThreadState_New(interp)
Py_AcquireThread(tstate)
...
PyEval_CallObject(cbfunc)
....
PyThreadState_Clear(tstate)
Py_ReleaseThread(tstate)
PyThreadState_Delete(tstate)






More information about the Python-list mailing list