[pypy-dev] Is the built-in re.py supposed to translate?

Alex Perry alex.perry at pamurray.com
Thu Mar 24 01:50:01 CET 2011

$ ./pypy-c translate.py target.py
 AnnotatorError: annotation of <pypy.annotation.dictdef.DictValue
object at 0x0000000004cd7a98> degenerated to SomeObject()
 Simple call of incompatible family:
      (KeyError getting at the binding!)

 Happened at file /usr/src/pypy/lib-python/2.7.0/re.py line 232

        cachekey = (type(key[0]),) + key
 ==>     p = _cache.get(cachekey)
        if p is not None:

 Previous annotation:
 Processing block:
 block at 9 is a <class 'pypy.objspace.flow.flowcontext.SpamBlock'>
 in (re:229)_compile__star_2
 containing the following operations:
       v0 = getitem(key_0, (0))
       v1 = type(v0)
       v2 = newtuple(v1)
       v3 = add(v2, key_0)
       v4 = simple_call((method get), v3)
       v5 = is_(v4, (None))
       v6 = is_true(v5)

$ cat target.py
#! /usr/bin/python2.6

def entry_point(argv):
 import re
 s = re.sub(r'[^a-fA-F\d]', '', str(argv[1]))
 print s.decode('hex')

def target(*args):
 return entry_point, None

if __name__ == '__main__':
 import sys

More information about the Pypy-dev mailing list