Text of bugs.python.org › issue16839 as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Issue 16839: segmentation fault when unicode(classic_class_instance) - Python tracker

Python Home About News Documentation Downloads Community Foundation Developer's Guide Issue Tracker Issues Search Random Issue Summaries Issues with patch Easy issues Stats User Administration User List Committer List Help Tracker Documentation Tracker Development Report Tracker Problem Issue16839 ➜ 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.

Created on 2013-01-02 13:50 by draftcode , last changed 2022-04-11 14:57 by admin . This issue is now closed . Files File name Uploaded Description Edit object_unicode.patch draftcode , 2013-01-02 13:50 review Messages (3) msg178811 - (view) Author: Masaya Suzuki (draftcode) Date: 2013-01-02 13:50 Python 2.7.3 crushes when the following code is run without any library, which means run python with -S option: class Test: pass unicode(Test()) In the course of the interpreter tries to find the "__unicode__" attribute in a class, it uses a cached python string of "__unicode__".

The reason of this crush is that the cached value is used before initialized. It is initialized only when trying to find the one of a new-style class, so the interpreter will crush if one uses only classic classes. The attached patch will fix this issue by initializing a cached value before it is used. Thanks. msg178817 - (view) Author: Benjamin Peterson (benjamin.peterson) * Date: 2013-01-02 15:35 Thank you for the bug report. msg178818 - (view) Author: Roundup Robot (python-dev) Date: 2013-01-02 15:37 New changeset 0012d4f0ca59 by Benjamin Peterson in branch '2.7': ensure the attribute name string is initalized before using it (closes #16839 ) http://hg.python.org/cpython/rev/0012d4f0ca59 History Date User Action Args 2022-04-11 14:57:40 admin set github: 61043 2013-02-21 02:33:36 ned.deily link issue17260 superseder 2013-01-02 20:44:45 jcea set nosy: + jcea 2013-01-02 15:37:52 python-dev set status: open -> closed nosy: + python-dev messages: + msg178818 resolution: fixed stage: patch review -> resolved 2013-01-02 15:35:16 benjamin.peterson set nosy: + benjamin.peterson messages: + msg178817 2013-01-02 14:32:32 daniel.urban set stage: patch review 2013-01-02 13:50:36 draftcode create Supported by The Python Software Foundation , Powered by Roundup Copyright © 1990-2022, Python Software Foundation Legal Statements