[pypy-dev] Two problems

Martin C. Martin martin at martincmartin.com
Fri Jan 25 16:30:17 CET 2008


Hi,

I'm really impressed with the C code generated for some functions I'd 
like to use in my project.  You guys rock!

I've run into two problems this morning.  In pypy-1.0.0, this:

import re
import os, sys
from pypy.translator.interactive import Translation
import py

def mytest():
    x = re.search('bar', 'foobar')
    return x.start()

t = Translation(mytest)
t.annotate()

throws an exception:

   File "/ita/downloaded/pypy-1.0.0/pypy/annotation/unaryop.py", line 
567, in simple_call
     return bltn.analyser(bltn.s_self, *args)
   File "/ita/downloaded/pypy-1.0.0/pypy/tool/instancemethod.py", line 
19, in __call__
     return self.im_func(firstarg, *args, **kwds)
TypeError': method_get() takes exactly 3 arguments (2 given)
         .. v1 = simple_call((builtin_function_or_method get), v0)
         .. '(sre:213)_compile_star2'


This is an InstanceMethod where im_self is a SomeDict and args is a 
tuple with a single element, a SomeTuple whose "const" is (<type 'str'>, 
'bar', 0) and whose "items" is (SomeObject, SomeString, SomeInteger). 
It seems to be calling a method_get() with two args, SomeDict and 
SomeTuple, whereas it wants 3.  Any idea how to fix this?

Thinking it might be fixed in svn, I got the latest code using:

svn co http://codespeak.net/svn/pypy/dist pypy-dist

Then tried to start pypy using:

python pypy-dist/pypy/bin/py.py

But got:

   File "/ita/downloaded/pypy-dist/pypy/module/posix/__init__.py", line 
3, in ?
     from pypy.rpython.module.ll_os import RegisterOs
   File "/ita/downloaded/pypy-dist/pypy/rpython/module/ll_os.py", line 127
     @registering_if(os, 'execv')
     ^
SyntaxError: invalid syntax

This is all on 64 bit Linux, python 2.4.1.

Any idea how I can get my simple function to compile?

Best,
Martin




More information about the Pypy-dev mailing list