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 meador.inge
Recipients meador.inge, pitrou, sbt, vstinner
Date 2012-02-23.20:03:34
SpamBayes Score 1.356042e-10
Marked as misclassified No
Message-id <1330027415.07.0.495856370159.issue14095@psf.upfronthosting.co.za>
In-reply-to
Content
I can reproduce the segfault on F16:

Python 3.3.0a0 (default:3828d93fd330, Feb 23 2012, 13:49:57) 
[GCC 4.4.6] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> d = {'__qualname__':'XXX'}
[66934 refs]
>>> T = type('foo', (), d)
[66956 refs]
>>> T
python: Objects/unicodeobject.c:301: _PyUnicode_CheckConsistency: Assertion `((((((PyObject*)(op))->ob_type))->tp_flags & ((1L<<28))) != 0)' failed.
Aborted (core dumped)

The patch looks mostly OK, but I can still segfault the interpreter by using a '__qualname__' of 'None':

Python 3.3.0a0 (default:3828d93fd330+, Feb 23 2012, 13:55:57) 
[GCC 4.4.6] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> d = {'__qualname__':'XXX'}
[67128 refs]
>>> T = type('foo', (), d)
[67156 refs]
>>> T
<class '__main__.XXX'>
[67161 refs]
>>> d = {'__qualname__': None}
[67161 refs]
>>> T = type('foo', (), d)
[67185 refs]
>>> T
python: Objects/unicodeobject.c:301: _PyUnicode_CheckConsistency: Assertion `((((((PyObject*)(op))->ob_type))->tp_flags & ((1L<<28))) != 0)' failed.
Aborted (core dumped)

Try this additional unit test:

        d = {'__qualname__': None}
        tp = type('foo', (), d)
        self.assertEqual(tp.__qualname__, None)
        self.assertEqual(tp.__dict__['__qualname__'], None)
        self.assertEqual(d, {'__qualname__': None})
        self.assertTrue(repr(tp))
History
Date User Action Args
2012-02-23 20:03:35meador.ingesetrecipients: + meador.inge, pitrou, vstinner, sbt
2012-02-23 20:03:35meador.ingesetmessageid: <1330027415.07.0.495856370159.issue14095@psf.upfronthosting.co.za>
2012-02-23 20:03:34meador.ingelinkissue14095 messages
2012-02-23 20:03:34meador.ingecreate