Skip to content

Fix iteration on Python 3.7#35

Open
Glutexo wants to merge 1 commit into
wglass:masterfrom
Glutexo:fix_iteration_on_python37
Open

Fix iteration on Python 3.7#35
Glutexo wants to merge 1 commit into
wglass:masterfrom
Glutexo:fix_iteration_on_python37

Conversation

@Glutexo

@Glutexo Glutexo commented Aug 7, 2018

Copy link
Copy Markdown

PEP 479 changed handling of StopIteration inside generators. Since Python 3.7, StopIteration errors raised from generators are implicitly converted to RuntimeErrors. The correct way of reporting the state when there is nothing more to yield is to return. See PEP 479/.

The import from __future__ ensures the same behavior on older versions of Python that don’t have this as default, making the tests fail without the actual fix. That includes Python 3.6.

The test_iterables tests pass. Unfortunately I didn’t get some errors when running the whole test suite, even with Python 3.6. It looks like those are not introduced by this PR, since they happen on master too.

Fixes #34 .

PEP 479 changed handling of StopIteration inside generators. Since
Python 3.7, StopIteration errors raised from generators are implicitly
converted to RuntimeErrors. The correct way of reporting the state
when there is nothing more to yield is to return.

Import from future ensures the same behavior on older versions of
Python that don’t have this as default.
@Glutexo

Glutexo commented Oct 26, 2020

Copy link
Copy Markdown
Author

@wglass May I ask for an input here? Close, merge?

@wglass

wglass commented Oct 27, 2020

Copy link
Copy Markdown
Owner

@wglass May I ask for an input here? Close, merge?

Sorry about that, kinda forgot this repo existed to tell the truth. If you can get the CI passing I'll merge it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Produce fails on Python 3.7

2 participants