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.

Author iankko
Recipients iankko
Date 2009-07-02.16:54:24
SpamBayes Score 4.2423363e-08
Marked as misclassified No
Message-id <1246553666.48.0.84202001291.issue6402@psf.upfronthosting.co.za>
In-reply-to
Content
Hello guys,

  i am experiencing segmentation fault, when trying to set the
error indicator via the PyErr_SetString() method called from C source.
This occurs for all Python exceptions, as documented in:

    http://docs.python.org/c-api/exceptions.html

Checked Python-2.6.2, also Python-2.4.1 - the crash is present
there (wondering what's wrong with the provided reproducer).

Scenario:
--------
tar xvzf pyexceptions-sample.tar.gz
cd pyexceptions-sample
make
./pyexceptionssample -> 
Segmentation fault (core dumped)

Note: Doesn't matter if compiled with libpython2.6.a or libpython2.4.so,
      the crash is still there.

Here is the most interesting part of the backtrace (the whole
coredump also attached).

gdb ./pyexceptions-sample core.31283

Core was generated by `./pyexceptions-sample'.
Program terminated with signal 11, Segmentation fault.
[New process 31283]
#0  PyErr_Restore (type=0x60000000000058f0, value=0x2000000000435030,
traceback=0x0) at Python/errors.c:39
39		oldtype = tstate->curexc_type;

(gdb) bt
#0  PyErr_Restore (type=0x60000000000058f0, value=0x2000000000435030,
traceback=0x0) at Python/errors.c:39
#1  0x4000000000125180 in PyErr_SetString (exception=0x60000000000058f0,
string=<value optimized out>) at Python/errors.c:57
#2  0x4000000000005eb0 in check_value ()
#3  0x4000000000006670 in main ()

(gdb) info args
type = (PyObject *) 0x60000000000058f0
value = (PyObject *) 0x2000000000435030
traceback = (PyObject *) 0x0

(gdb) info locals
tstate = (PyThreadState *) 0x0
oldtype = <value optimized out>
oldvalue = <value optimized out>
oldtraceback = <value optimized out>

(Looks like NULL ptr dereference in tstate = (PyThreadState *)).

Could you please have a look?

Thanks && regards, Jan.
--
Jan iankko Lieskovsky
History
Date User Action Args
2009-07-02 16:54:26iankkosetrecipients: + iankko
2009-07-02 16:54:26iankkosetmessageid: <1246553666.48.0.84202001291.issue6402@psf.upfronthosting.co.za>
2009-07-02 16:54:25iankkolinkissue6402 messages
2009-07-02 16:54:24iankkocreate