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

False-positive (E1130) on the return value of random.sample #7706

Closed
bersbersbers opened this issue Nov 3, 2022 · 1 comment
Closed

False-positive (E1130) on the return value of random.sample #7706

bersbersbers opened this issue Nov 3, 2022 · 1 comment
Assignees
Labels
Astroid Related to astroid Needs astroid update Needs an astroid update (probably a release too) before being mergable
Milestone

Comments

@bersbersbers
Copy link

bersbersbers commented Nov 3, 2022

Bug description

"""False-positive invalid-unary-operand-type"""
from random import sample

all_i: list[int] = [0, 1, 2]

for i in all_i:
    print(-i)

for i in sample(all_i, len(all_i)):
    print(-i)  # pylint raises E1130

Configuration

No response

Command used

pylint bug.py

Pylint output

************* Module bug
bug.py:10:10: E1130: bad operand type for unary -: NoneType (invalid-unary-operand-type)

Expected behavior

No error. Related: #811, of which the invalid-sequence-index part seems to be unresolved/have regressed.

Pylint version

pylint 2.15.5
astroid 2.12.12
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]

OS / Environment

Windows 10

Additional dependencies

No response

@bersbersbers bersbersbers added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Nov 3, 2022
@mbyrnepr2 mbyrnepr2 added Astroid Related to astroid and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Nov 3, 2022
mbyrnepr2 added a commit to mbyrnepr2/astroid that referenced this issue Nov 3, 2022
@mbyrnepr2 mbyrnepr2 self-assigned this Nov 3, 2022
@cdce8p cdce8p added the Needs astroid update Needs an astroid update (probably a release too) before being mergable label Nov 4, 2022
@cdce8p cdce8p added this to the 2.15.6 milestone Nov 4, 2022
cdce8p pushed a commit to pylint-dev/astroid that referenced this issue Nov 4, 2022
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.15.6, 2.15.7 Nov 14, 2022
@bersbersbers
Copy link
Author

This seems to be fixed with astroid==2.12.13 / pylint==2.15.6. Thanks :)

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.15.7, 2.15.6 Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Needs astroid update Needs an astroid update (probably a release too) before being mergable
Projects
None yet
Development

No branches or pull requests

4 participants