This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_capi failure
Type: behavior Stage:
Components: Library (Lib), Tests Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jyasskin, pitrou
Priority: normal Keywords:

Created on 2010-05-15 21:10 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg105824 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-15 21:10
[...]
test_capi
test test_capi failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/test/test_capi.py", line 49, in test_no_FatalError_infinite_loop
    b'Fatal Python error:'
AssertionError: b'' != b'Fatal Python error: PyThreadState_Get: no current thread'
msg105826 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-15 21:25
It turns out that the test segfaults:

$ ./python -E -bb -c "import _testcapi; _testcapi.crash_no_current_thread()"
Erreur de segmentation (core dumped)


And here is the backtrace:

Program terminated with signal 11, Segmentation fault.
#0  PyErr_SetObject (exception=<type at remote 0x7970c0>, value='bork bork bork') at Python/errors.c:67
67	    exc_value = tstate->exc_value;
Missing debug package(s), you should install: glibc-debug-2.11.1-6mnb2.x86_64
(gdb) bt
#0  PyErr_SetObject (exception=<type at remote 0x7970c0>, value='bork bork bork') at Python/errors.c:67
#1  0x000000000046d0e7 in PyErr_SetString (exception=<type at remote 0x7970c0>, string=<value optimized out>)
    at Python/errors.c:125
#2  0x00007f6a0b31ec1f in crash_no_current_thread (self=<value optimized out>)
    at /home/antoine/py3k/__svn__/Modules/_testcapimodule.c:2014
#3  0x000000000045fb74 in call_function (f=Frame 0x184dcc0, for file <string>, line 1, in <module> (), 
    throwflag=<value optimized out>) at Python/ceval.c:3854
#4  PyEval_EvalFrameEx (f=Frame 0x184dcc0, for file <string>, line 1, in <module> (), throwflag=<value optimized out>)
    at Python/ceval.c:2670
#5  0x0000000000460715 in PyEval_EvalCodeEx (co=0x7f6a0d100d78, globals=<value optimized out>, 
    locals=<value optimized out>, args=0x0, argcount=<value optimized out>, kws=<value optimized out>, kwcount=0, defs=
    0x0, defcount=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:3307
#6  0x000000000046098b in PyEval_EvalCode (co=0x7970c0, globals='bork bork bork', locals=0x0) at Python/ceval.c:746
#7  0x0000000000482d6f in run_mod (command=<value optimized out>, flags=<value optimized out>) at Python/pythonrun.c:1716
#8  PyRun_StringFlags (command=<value optimized out>, flags=<value optimized out>) at Python/pythonrun.c:1650
#9  PyRun_SimpleStringFlags (command=<value optimized out>, flags=<value optimized out>) at Python/pythonrun.c:1226
#10 0x0000000000495a37 in Py_Main (argc=<value optimized out>, argv=<value optimized out>) at Modules/main.c:570
#11 0x0000000000414b95 in main (argc=5, argv=<value optimized out>) at ./Modules/python.c:50


That's probably because PyThreadState_GET() gets compiled to a simple lookup in non-debug mode, and doesn't trigger the fatal error.
msg105828 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2010-05-15 21:37
Ah, darn. Any thoughts on what do to? Shall I make the test conditional on a pydebug build, or just remove it?
msg105830 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-15 21:45
Your test could call PyThreadState_Get() explicitly, before calling PyErr_SetString() (which should then never get executed).
msg105915 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) Date: 2010-05-17 17:00
Fixed in r81269. Sorry about that.
History
Date User Action Args
2022-04-11 14:57:01adminsetgithub: 52972
2010-05-17 17:00:01jyasskinsetstatus: open -> closed
resolution: fixed
messages: + msg105915
2010-05-15 21:45:39pitrousetmessages: + msg105830
2010-05-15 21:37:33jyasskinsetmessages: + msg105828
2010-05-15 21:25:45pitrousetmessages: + msg105826
2010-05-15 21:19:03pitrousetnosy: + jyasskin
2010-05-15 21:10:58pitroucreate