[pypy-dev] Two problems

Maciek Fijalkowski fijal at genesilico.pl
Fri Jan 25 16:40:34 CET 2008


Martin C. Martin wrote:
> 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'
>
>   
re is not RPythonic, you cannot use it.
> 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
>   
this is valid 2.4 syntax (it does not work on 2.3 though), are you sure 
you're using 2.4?

Also, 64 bit might only work on svn (and only *might*)

Cheers,
fijal


:.




More information about the Pypy-dev mailing list