[pypy-issue] Issue #2353: Confusing type error: AttributeError: RangeIteratorRepr instance has no attribute ll_getnextindex (pypy/pypy)

Sarah Mount issues-reply at bitbucket.org
Mon Jul 25 15:55:27 EDT 2016


New issue 2353: Confusing type error: AttributeError: RangeIteratorRepr instance has no attribute ll_getnextindex
https://bitbucket.org/pypy/pypy/issues/2353/confusing-type-error-attributeerror

Sarah Mount:

The call to **enumerate** in the example interpreter below produces the confusing error message also shown.

```
#!python

$ cat example.py

def entry_point(argv):
    for x, y in enumerate(xrange(10)):
        print x, y
    return 0


def target(driver, args):
    return entry_point, None

$ .../pypy/rpython/bin/rpython -Ojit example.py 

...

[translation:info] Error:
   File "/home/snim2/Desktop/working/pypy/rpython/translator/goal/translate.py", line 317, in main
    drv.proceed(goals)
   File "/home/snim2/Desktop/working/pypy/rpython/translator/driver.py", line 551, in proceed
    result = self._execute(goals, task_skip = self._maybe_skip())
   File "/home/snim2/Desktop/working/pypy/rpython/translator/tool/taskengine.py", line 114, in _execute
    res = self._do(goal, taskcallable, *args, **kwds)
   File "/home/snim2/Desktop/working/pypy/rpython/translator/driver.py", line 278, in _do
    res = func()
   File "/home/snim2/Desktop/working/pypy/rpython/translator/driver.py", line 345, in task_rtype_lltype
    rtyper.specialize(dont_simplify_again=True)
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rtyper.py", line 188, in specialize
    self.specialize_more_blocks()
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rtyper.py", line 231, in specialize_more_blocks
    self.specialize_block(block)
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rtyper.py", line 316, in specialize_block
    hop.setup()  # this is called from here to catch TyperErrors...
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rtyper.py", line 639, in setup
    self.r_result = rtyper.getrepr(self.s_result)
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rtyper.py", line 158, in getrepr
    result = s_obj.rtyper_makerepr(self)
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rmodel.py", line 282, in rtyper_makerepr
    return EnumerateIteratorRepr(r_baseiter)
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rrange.py", line 204, in __init__
    self.ll_getnextindex = r_baseiter.ll_getnextindex
   File "/home/snim2/Desktop/working/pypy/rpython/rtyper/rmodel.py", line 107, in __getattr__
    self.__class__.__name__, name))
[translation:ERROR] AttributeError: RangeIteratorRepr instance has no attribute ll_getnextindex
[translation] start debugger...
> /home/snim2/Desktop/working/pypy/rpython/rtyper/rmodel.py(107)__getattr__()
-> self.__class__.__name__, name))
```




More information about the pypy-issue mailing list