[pypy-issue] [issue1252] Limnoria can't run with pypy
Amaury Forgeot d Arc
tracker at bugs.pypy.org
Wed Sep 5 02:05:16 CEST 2012
Amaury Forgeot d Arc <amauryfa at gmail.com> added the comment:
See minimal test case below. It seems that re.sub() returns the input string when no match was found; this optimization
should not be done when a string subclass is given.
PyPy should be fixed, but this could be considered an implementation detail as well.
The class IrcString should be more robust and ensure that x.lowered is not a IrcString! otherwise the __hash__ method
enters a nasty recursion.
x.lowered = str(toLower(x))
import re
class MyString(str):
pass
s1 = MyString('zz')
s2 = re.compile('aa').sub('bb', s1)
print s1 is s2
# True in Pypy which returns a str subclass;
# False for CPython which creates an exact str instance.
----------
nosy: +afa
status: unread -> chatting
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1252>
________________________________________
More information about the pypy-issue
mailing list