]> granicus.if.org Git - python/commit
Subclasses of string can no longer be interned. The semantics of
authorJeremy Hylton <jeremy@alum.mit.edu>
Sat, 7 Aug 2004 19:20:05 +0000 (19:20 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Sat, 7 Aug 2004 19:20:05 +0000 (19:20 +0000)
commit4c989ddc9c8bd38ab14c9f42511eb567ed219604
tree9e91f6cf6dd52b386920c4123132f846b94e4817
parentcbd81556bb975b72697d2989eccfbc9f3e39b3de
Subclasses of string can no longer be interned.  The semantics of
interning were not clear here -- a subclass could be mutable, for
example -- and had bugs.  Explicitly interning a subclass of string
via intern() will raise a TypeError.  Internal operations that attempt
to intern a string subclass will have no effect.

Added a few tests to test_builtin that includes the old buggy code and
verifies that calls like PyObject_SetAttr() don't fail.  Perhaps these
tests should have gone in test_string.
Lib/test/test_builtin.py
Misc/NEWS
Objects/stringobject.c
Python/bltinmodule.c