You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"pyo" macro from gdbinit (see bpo-3631) uses _PyObject_Dump() to display
an object. This function calls (indirectly) string_print() to display
one line of text. But if the GIL is released (I guess it's the GIL or
is it called the "thread state"?), gdb crashs Python:
object : Fatal Python error: PyEval_SaveThread: NULL tstate
Program received signal SIGABRT, Aborted.
0xffffe410 in __kernel_vsyscall ()
Workaround: ensure GIL before Py_BEGIN_ALLOW_THREADS... That sounds
ugly but it works :-) So I propose to enable it in debug mode (#ifdef
Py_DEBUG) with a patch.
I guess that the issue is very specific to (gdb) debugging and should
not affect normal usage of Python. That's why I choosed to enable it
only in debug mode.
I once fell into the same issue, but the patch should modify
_PyObject_Dump(), around the call to PyObject_Print.
string_print() is not the only function called by _PyObject_Dump, by far...
And beware that many people routinely run python in "debug mode" outside
gdb, for example during development.
That's why it's better to modify _PyObject_Dump only; we can be sure
that it only affects a debugger session.
The patch is fine.
I don't know if it can make the 2.6 release, but it is very simple, and
affect only a function used in debugger macros.
devdanzin commented on Sep 13, 2008
devdanzinmannequin
Mannequin
More actions
I would love to have this patch, along with those of bpo-3631 and bpo-3610,
included in Misc as diffs. This would make it easier to get the improved
functionality in a new development box, besides allowing distributions
to apply them at will.
Activity
vstinner commentedon Aug 21, 2008
"pyo" macro from gdbinit (see bpo-3631) uses _PyObject_Dump() to display
an object. This function calls (indirectly) string_print() to display
one line of text. But if the GIL is released (I guess it's the GIL or
is it called the "thread state"?), gdb crashs Python:
object : Fatal Python error: PyEval_SaveThread: NULL tstate
Program received signal SIGABRT, Aborted.
0xffffe410 in __kernel_vsyscall ()
Workaround: ensure GIL before Py_BEGIN_ALLOW_THREADS... That sounds
ugly but it works :-) So I propose to enable it in debug mode (#ifdef
Py_DEBUG) with a patch.
I guess that the issue is very specific to (gdb) debugging and should
not affect normal usage of Python. That's why I choosed to enable it
only in debug mode.
amauryfa commentedon Aug 21, 2008
I once fell into the same issue, but the patch should modify
_PyObject_Dump(), around the call to PyObject_Print.
string_print() is not the only function called by _PyObject_Dump, by far...
And beware that many people routinely run python in "debug mode" outside
gdb, for example during development.
That's why it's better to modify _PyObject_Dump only; we can be sure
that it only affects a debugger session.
vstinner commentedon Aug 21, 2008
Oh! I have a better idea: why not patching _PyObject_Dump() instead of
string_print() :-) So here is a new patch.
vstinner commentedon Sep 8, 2008
Can anyone review my new patch?
amauryfa commentedon Sep 9, 2008
The patch is fine.
I don't know if it can make the 2.6 release, but it is very simple, and
affect only a function used in debugger macros.
devdanzin commentedon Sep 13, 2008
I would love to have this patch, along with those of bpo-3631 and bpo-3610,
included in Misc as diffs. This would make it easier to get the improved
functionality in a new development box, besides allowing distributions
to apply them at will.
vstinner commentedon Dec 11, 2008
Can anyone apply this patch? Or explain me why it can not be applied?
amauryfa commentedon Dec 15, 2008
Committed in r67802.