[Python-Dev] Disabling string interning for null and single-char causes segfaults

Victor Stinner victor.stinner at gmail.com
Mon Mar 4 21:46:49 CET 2013


Hi,

2013/3/4 Amaury Forgeot d'Arc <amauryfa at gmail.com>:
> The example above is obviously from python2.7; there is a similar example
> with python3.2:
>>>> x = b'\xe9\xe9'.decode('ascii', 'ignore')
>>>> x == '', x is ''
> (True, False)
>
> ...but this bug has been fixed in 3.3: PyUnicode_Resize() always returns the
> unicode_empty singleton.

Yeah, I tried to reuse singletons (empty string and latin-1 single
letters) as much as possible to reduce memory footprint, not to ensure
that an empty string is always the '' singleton.

I wouldn't call this a bug.

Victor


More information about the Python-Dev mailing list