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

Return value of numpy.bincount misidentified as tuple instead of ndarray #3974

Closed
hemberger opened this issue Dec 9, 2020 · 1 comment · Fixed by pylint-dev/astroid#918
Closed
Assignees
Labels
Astroid Related to astroid Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)

Comments

@hemberger
Copy link
Contributor

Steps to reproduce

  1. Create a file test.py:
"""docstring"""
import numpy
numpy.bincount([1,2,3]).argmax()
  1. Run pylint test.py

Current behavior

~ $ pylint test.py
************* Module test
test.py:3:0: E1101: Instance of 'tuple' has no 'argmax' member (no-member)

Expected behavior

No error, because numpy.bincount returns an ndarray (see https://numpy.org/doc/stable/reference/generated/numpy.bincount.html).

pylint --version output

pylint 2.6.1-dev1
astroid 2.4.2
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0]

(I have tested that this error exists at least as far back as pylint 2.4.2 w/ astroid 2.3.1.)

@hippo91
Copy link
Contributor

hippo91 commented Dec 12, 2020

@hemberger thanks for your report. It sounds like our astroid's numpy brain needs to be be updated.

@hippo91 hippo91 added Astroid Related to astroid Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade) Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code labels Dec 12, 2020
@hippo91 hippo91 self-assigned this Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants