[Python-3000] Need help fixing failing Py3k Unittests in py3k-struni (original) (raw)

Christian Heimes lists at cheimes.de
Wed Jul 11 03:54:49 CEST 2007


I found a bug in the str type that may affect a lot of tests.

In the py3k-struni branch the str() constructor doesn't use str when the argument is an instance of a subclass of str. A user defined string can't change str(). The repr method isn't affected.

It works in Python 2.5 and in the p3yk branch.

Python 3.0x (py3k-struni:56245, Jul 10 2007, 23:34:56) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

class Mystr(str): ... def str(self): return 'v' ... s = Mystr('x') s 'x' str(s) 'x' # <- SHOULD RETURN 'v'

Christian



More information about the Python-3000 mailing list