pdb with threads & PyEval_CallObject

Immanuel immanuel at yours.com
Tue Mar 20 09:34:25 EST 2001


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