[New-bugs-announce] [issue16839] segmentation fault when unicode(classic_class_instance)

Masaya Suzuki report at bugs.python.org
Wed Jan 2 14:50:36 CET 2013


New submission from Masaya Suzuki:

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.

----------
components: Interpreter Core
files: object_unicode.patch
keywords: patch
messages: 178811
nosy: draftcode
priority: normal
severity: normal
status: open
title: segmentation fault when unicode(classic_class_instance)
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file28528/object_unicode.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16839>
_______________________________________


More information about the New-bugs-announce mailing list