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.

Title: Seg fault when calling unicode() on old style object in virtualenv
Type: crash Stage: resolved
Components: Unicode Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: segmentation fault when unicode(classic_class_instance)
View: 16839
Assigned To: Nosy List: ezio.melotti, johtso, ned.deily, pitrou
Priority: normal Keywords:

Created on 2013-02-20 22:28 by johtso, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit johtso, 2013-02-20 22:28
Messages (5)
msg182562 - (view) Author: Johannes (johtso) Date: 2013-02-20 22:28
Running the code attached causes a segmentation fault.

This only occurs when run from within a virtual environment, and when the class is an old style class.

I've tested on OSX with both 2.7.3 installed via Homebrew, and the default 2.7.2 Python installation.

Also got the same result testing with 2.7.3 on linux ([GCC 4.4.5] on linux2)

I've verified that exactly the same Python installation is being used inside and outside of the virtual env.

Running the same code under 2.5 and 2.6 results in no seg fault.
msg182564 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-02-20 23:03
Can you please post a gdb traceback?
msg182573 - (view) Author: Johannes (johtso) Date: 2013-02-21 00:18
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x000000010004e221 in PyObject_GetAttr ()
(gdb) bt
#0  0x000000010004e221 in PyObject_GetAttr ()
#1  0x000000010004e0ff in PyObject_Unicode ()
#2  0x000000010007ee57 in unicode_new ()
#3  0x0000000100063cbc in type_call ()
#4  0x00000001000108d1 in PyObject_Call ()
#5  0x00000001000a5a1a in PyEval_EvalFrameEx ()
#6  0x00000001000a313f in PyEval_EvalCodeEx ()
#7  0x00000001000a2916 in PyEval_EvalCode ()
#8  0x00000001000c9e2e in PyRun_FileExFlags ()
#9  0x00000001000c980a in PyRun_SimpleFileExFlags ()
#10 0x00000001000ded8a in Py_Main ()
#11 0x0000000100000e4a in ?? ()
#12 0x0000000100000d51 in ?? ()
msg182574 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-02-21 01:53
I can reproduce the segfault with a v2.7.3 Python + virtualenv but not with a current 2.7 tip Python + virtualenv.  Nothing comes to mind immediately; I'll try bisecting.
msg182576 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-02-21 02:33
Duh! Issue16839 "segmentation fault when unicode(classic_class_instance)"

That was recently fixed and will be available in the upcoming 2.7.4 maintenance release.
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61462
2013-02-21 02:33:36ned.deilysetstatus: open -> closed
superseder: segmentation fault when unicode(classic_class_instance)
messages: + msg182576

resolution: duplicate
stage: resolved
2013-02-21 01:53:51ned.deilysetnosy: + ned.deily
messages: + msg182574
2013-02-21 00:18:25johtsosetmessages: + msg182573
2013-02-20 23:03:37pitrousetnosy: + pitrou
messages: + msg182564
2013-02-20 22:31:06johtsosettitle: Seg fault when calling unicode() on old style class in virtualenv -> Seg fault when calling unicode() on old style object in virtualenv
2013-02-20 22:28:36johtsocreate