Well, I switched to using sourcetools.compile_template and the error went
away, so I was probably doing something wrong with how I compiled the
template.

Timothy

On Tue, May 1, 2018 at 4:21 PM, Timothy Baldridge <tbaldri...@gmail.com>
wrote:

> I have a strange error, I'm generating code for a RPython program and get
> this error:
>
> [translation:ERROR] AttributeError: 'FrozenDesc' object has no attribute
> 'pycall'
> Processing block:
>  block@9[fn_0...] is a <class 'rpython.flowspace.flowcontext.SpamBlock'>
>  in (?:10)make_thunk
>  containing the following operations:
>        v2 = simple_call((type Thunk_thunk10_), fn_0, args_0)
>
>
> And I'm generating it thusly:
>
> thunk_template = """
> class Thunk_{sym}(ThunkBase):
>   def __init__(self, fn, args):
>      self._{sym}_fn = fn
>      self._{sym}_args = args
>
>   def run_thunk(self):
>      return self._{sym}_fn(*self._{sym}_args)
>
> def make_thunk(fn, args):
>   return Thunk_{sym}(fn, args)
> """
>
>
>
> def make_thunk():
>     gbls = dict(ThunkBase=ThunkBase, object=object)
>     sym = gen_sym.get_sym("thunk")
>     code = thunk_template.format(sym=sym)
>     exec(code, gbls)
>     cls = gbls["make_thunk"]
>     return cls
>
>
> It's as if RPython isn't recognizing that the type is callable.
>
> Any thoughts?
>
> Thanks,
>
> Timothy
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to