Hello, Hopefully a very simple question. I am trying out RPython toolchain. pypy 2.6, python 2.7. I am using the translator shell.
Here's my simple example: python bin/translatorshell.py class mtype(): def __init__(self): self.x = 0; def mmm(x): z = x.x + 1 return z t = Translation(mmm, [mtype]) t.annotate() and it gives me the following. if you put mtype class and mmm function definitions in a separate module, then you can see it complains about this line: z = x.x + 1. Why can't it infer type for all arguments and the result here? I know i am missing something basic. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/translator/interactive.py", line 89, in annotate return self.driver.annotate() File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/translator/driver.py", line 106, in proc return self.proceed(backend_goal) File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/translator/driver.py", line 549, in proceed return self._execute(goals, task_skip = self._maybe_skip()) File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/translator/tool/taskengine.py", line 114, in _execute res = self._do(goal, taskcallable, *args, **kwds) File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/translator/driver.py", line 277, in _do res = func() File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/translator/driver.py", line 314, in task_annotate s = annotator.build_types(self.entry_point, self.inputtypes) File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/annotator/annrpython.py", line 89, in build_types return self.build_graph_types(flowgraph, inputcells, complete_now=complete_now) File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/annotator/annrpython.py", line 135, in build_graph_types self.complete() File "/nfs/site/disks/scl.work.58/ppt/aayupov/hld/pypy-2.6.0-src/rpython/annotator/annrpython.py", line 211, in complete raise annmodel.AnnotatorError(text) rpython.annotator.model.AnnotatorError: Blocked block -- operation cannot succeed v0 = getattr(x_0, ('x')) In <FunctionGraph of (__main__:1)mmm at 0x7ffff2b69ed0>: no source! Known variable annotations: x_0 = SomeInstance(can_be_None=False, classdef=__main__.mtype) Thanks! Andrey
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev