Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Defining an interator for a class in a separate class no longer works properly in 3.13. With the following test_iter.py:
classlist2(list): def__iter__(self): returnlist2iterator(self) classlist2iterator: def__init__(self, X): self._X=Xself._pointer=-1def__next__(self): self._pointer+=1ifself._pointer==len(self._X): self._pointer=-1raiseStopIterationreturnself._X[self._pointer]With Python 3.13.1 one gets:
>>>fromtest_iterimportlist2>>>X=list2([1,2,3]) >>> [xforxinX] Traceback (mostrecentcalllast): File"<python-input-2>", line1, in<module> [xforxinX] ^TypeError: 'list2iterator'objectisnotiterableWith Python 3.12.7 it works:
>>>fromtest_iterimportlist2>>>X=list2([1,2,3]) >>> [xforxinX] [1, 2, 3]Bisected to bcc7227e
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error