[Python-Dev] Re: [Python-checkins] python/dist/src/Lib/test test_builtin.py, 1.33, 1.34

Michael Hudson mwh at python.net
Sat Aug 7 21:53:00 CEST 2004


jhylton at users.sourceforge.net writes:

> Update of /cvsroot/python/python/dist/src/Lib/test
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9225/Lib/test
>
> Modified Files:
> 	test_builtin.py 
> Log Message:
> 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.

Would have been nice if you'd run the test suite before checking this
in... test_descr contains stuff like:

    s = madstring("x y")
    vereq(s, "x y")
    verify(intern(s).__class__ is str)
    verify(intern(s) is intern("x y"))
    vereq(intern(s), "x y")

though if madstring was mad enough to redefine __hash__, maybe it
wouldn't.

Cheers,
mwh

-- 
  > It might get my attention if you'd spin around in your chair,
  > spoke in tongues, and puked jets of green goblin goo.
  I can arrange for this.  ;-)            -- Barry Warsaw & Fred Drake


More information about the Python-Dev mailing list