Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging.tags.compatible_tags is not re-creating a new iterator #257

Closed
jeroendecroos opened this issue Jan 21, 2020 · 2 comments · Fixed by #258 or sthagen/packaging#1
Closed

packaging.tags.compatible_tags is not re-creating a new iterator #257

jeroendecroos opened this issue Jan 21, 2020 · 2 comments · Fixed by #258 or sthagen/packaging#1

Comments

@jeroendecroos
Copy link
Contributor

@jeroendecroos jeroendecroos commented Jan 21, 2020

With the release of pip==20.0.1 a problem was observed as described here: pypa/pip#7626

The problem was tracked back to packaging.tags.compatible_tags

When no iterator is given for parameter platforms, an iterator is initialized:

platforms = _platform_tags()

Which is then used in:

for platform_ in platforms:

This should be the otherway around, to not reuse the exhausted iterator.

jeroendecroos pushed a commit to jeroendecroos/packaging that referenced this issue Jan 21, 2020
jeroendecroos pushed a commit to jeroendecroos/packaging that referenced this issue Jan 21, 2020
jeroendecroos added a commit to jeroendecroos/packaging that referenced this issue Jan 21, 2020
@brettcannon

This comment has been minimized.

Copy link
Contributor

@brettcannon brettcannon commented Jan 21, 2020

I'm not quite seeing the bug on our side. If no iterator is provided then we create one from _platform_tags() and then we use it in the for loop. The API specifically asks for an iterator, so I'm not seeing the issue. Are you suggesting we test for platforms is None?

@brettcannon

This comment has been minimized.

Copy link
Contributor

@brettcannon brettcannon commented Jan 21, 2020

nm, I see the issue now; it's the for loop using platforms being within another for loop.

brettcannon added a commit that referenced this issue Jan 21, 2020
The code was using an iterable in an inner loop which would lead to iterator exhaustion after the first time round the loop.

Closes #257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.