[pypy-dev] String replace() method causing error on translate

Nathan Alday n.c.alday at gmail.com
Mon Mar 19 03:49:08 CET 2012


I'm trying to see if I can get Peter Norvig's lis.py (from here:
http://norvig.com/lispy.html) to translate using translate.py, but I get
the following error:

AnnotatorError:
[translation:ERROR]
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
[translation:ERROR] Blocked block -- operation cannot succeed
[translation:ERROR]  v0 = getattr(s_0, ('replace'))
[translation:ERROR] In <FunctionGraph of (lis:83)tokenize at 0x8f646e4>:
[translation:ERROR] Happened at file lispy/lis.py line 85
[translation:ERROR]
[translation:ERROR] ==>     output = s.replace('(',' ( ')
[translation:ERROR]         output = output.replace( ')', ' ) ')
[translation:ERROR]         return output.split()
[translation:ERROR]
[translation:ERROR] Known variable annotations:
[translation:ERROR]  s_0 = SomePBC(can_be_None=True, const=None,
subset_of=None)



caused by:

def tokenize(s):
    "Convert a string into a list of tokens."
    output = s.replace('(',' ( ')
    output = output.replace( ')', ' ) ')
    return output.split()


It's not clear to me what the issue is. Is there another type that has a
replace method that is confusing the type inference system?

Thanks,
--Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120318/176a513e/attachment.html>


More information about the pypy-dev mailing list