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

Serhiy Storchaka storchaka at gmail.com
Mon Mar 4 16:40:54 CET 2013


On 01.03.13 17:24, Stefan Bucur wrote:
> Before digging deeper into the issue, I wanted to ask here if there are
> any implicit assumptions about string identity and interning throughout
> the interpreter implementation. For instance, are two single-char
> strings having the same content supposed to be identical objects?

I think this is not a bug if the code relies on the fact that an empty 
string is a singleton. This obviously is an immutable object and there 
is no public method to create different empty string. But a user can 
create different 1-character strings with same value (first create 
uninitialized a 1-character string and than fill a content). If some 
code fails when none of 1-character strings are interned, this obviously 
is a bug.




More information about the Python-Dev mailing list