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

Do not crash if next() is called without arguments #7831

Merged
merged 1 commit into from Nov 24, 2022

Conversation

clavedeluna
Copy link
Collaborator

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Pylint should not crash if next() is called, even tho that's incorrect python!

Closes #7828

@coveralls
Copy link

coveralls commented Nov 23, 2022

Pull Request Test Coverage Report for Build 3543376537

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0005%) to 95.422%

Totals Coverage Status
Change from base Build 3543148361: 0.0005%
Covered Lines: 17551
Relevant Lines: 18393

πŸ’› - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.7 milestone Nov 23, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks :) We're going to have to fix the stdlib primer before merging.

@@ -1135,6 +1135,10 @@ def _looks_like_infinite_iterator(param: nodes.NodeNG) -> bool:
# A next() method, which is now what we want.
return

if len(node.args) == 0:
# builtin next method should never be called without args.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# builtin next method should never be called without args.
# handle cases where builtin.next was called with args.
# see https://github.com/PyCQA/pylint/issues/7828

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "handle cases where builtin.next was called withOUT args."?

@@ -0,0 +1,3 @@
Fixes a crash during ``stop-iteration-return`` if builtin ``next`` is called without arguments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fixes a crash during ``stop-iteration-return`` if builtin ``next`` is called without arguments.
Fixes a crash in ``stop-iteration-return`` when the ``next`` builtin is called without arguments.

@clavedeluna
Copy link
Collaborator Author

We're going to have to fix the stdlib primer before ...

opened #7832 to see who can pick it up. I may be able to later today but it's pressing so first comes first gets!

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas added the Blocked 🚧 Blocked by a particular issue label Nov 23, 2022
@Pierre-Sassoulas
Copy link
Member

Blocked by #7826

@Pierre-Sassoulas Pierre-Sassoulas removed the Blocked 🚧 Blocked by a particular issue label Nov 24, 2022
@github-actions
Copy link
Contributor

πŸ€– According to the primer, this change has no effect on the checked open source code. πŸ€–πŸŽ‰

This comment was generated for commit fc146c7

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘Œ

@Pierre-Sassoulas Pierre-Sassoulas merged commit a9c1cda into pylint-dev:main Nov 24, 2022
@Pierre-Sassoulas Pierre-Sassoulas changed the title Do not crash if next()` is called Do not crash if next() is called without arguments Nov 24, 2022
github-actions bot pushed a commit that referenced this pull request Nov 24, 2022
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
(cherry picked from commit a9c1cda)
Pierre-Sassoulas pushed a commit that referenced this pull request Nov 24, 2022
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
(cherry picked from commit a9c1cda)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported Crash πŸ’₯ A bug that makes pylint crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pylint crashed with a IndexError
4 participants