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

Bug pylint 4960 #1176

Merged
merged 12 commits into from
Sep 25, 2021
Merged

Bug pylint 4960 #1176

merged 12 commits into from
Sep 25, 2021

Conversation

hippo91
Copy link
Contributor

@hippo91 hippo91 commented Sep 16, 2021

Steps

  • [*] For new features or bug fixes, add a ChangeLog entry describing what your PR does.
  • [*] Write a good description on what the PR does.

Description

The PR #1148 introduced a regression that causes pylint-dev/pylint#4960.
While the idea behind #1148 may be a good idea, its implementation was faulty and prevent the use of brains even if the node that are modified inside those brains are not part of a potentially dynamically loaded module.
I didn't find a correct implementation that prevent the modification of nodes that are defined inside a dynamically loaded module.
That's why this PR is a partial revert of #1148. (revert concerns only the builder module).
I also added a numpy brain that allows pylint to infer correctly the call to numpy.ma.masked_where function so that pylint-dev/pylint#3342 will be definitely closed.

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes pylint-dev/pylint#3342
Closes pylint-dev/pylint#4960

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.8.1 milestone Sep 16, 2021
@Pierre-Sassoulas
Copy link
Member

Hey, the issue with the CI was fixed, you can rebase on main :)

@hippo91
Copy link
Contributor Author

hippo91 commented Sep 17, 2021

Thanks @Pierre-Sassoulas !

@hippo91
Copy link
Contributor Author

hippo91 commented Sep 18, 2021

@Pierre-Sassoulas have you got an idea why the CI test is failing? Here is the stack:

 Submitting coverage to coveralls.io...
Could not submit coverage: 405 Client Error: Not Allowed for url: https://coveralls.io/api/v1/jobs
Traceback (most recent call last):
  File "/home/runner/work/astroid/astroid/venv/lib/python3.8/site-packages/coveralls/api.py", line 290, in submit_report
    response.raise_for_status()
  File "/home/runner/work/astroid/astroid/venv/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: Not Allowed for url: https://coveralls.io/api/v1/jobs

@DanielNoord
Copy link
Collaborator

Coveralls is down. They are doing a database update it seems.

@hippo91
Copy link
Contributor Author

hippo91 commented Sep 18, 2021

Thanks @DanielNoord !

@hippo91 hippo91 requested review from Pierre-Sassoulas and cdce8p and removed request for Pierre-Sassoulas September 19, 2021 10:13
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.

Would it be possible to rebase on main instead of merging, please ? There's change from the main branch mixed in the diff so it's hard to review (especially considering that there was a lot of changes between f-strings migration and membership check migration from tuple to set)

@hippo91
Copy link
Contributor Author

hippo91 commented Sep 19, 2021

@Pierre-Sassoulas i just rebase. Now there are only 4 files that are different!

ChangeLog Outdated Show resolved Hide resolved
@cdce8p cdce8p added the pylint-tested PRs that don't cause major regressions with pylint label Sep 19, 2021
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

The change looks good. Just some small comments

ChangeLog Outdated Show resolved Hide resolved
tests/unittest_brain_numpy_ma.py Outdated Show resolved Hide resolved
tests/unittest_brain_numpy_ma.py Outdated Show resolved Hide resolved
tests/unittest_brain_numpy_ma.py Outdated Show resolved Hide resolved
tests/unittest_brain_numpy_ma.py Outdated Show resolved Hide resolved
tests/unittest_brain_numpy_ma.py Outdated Show resolved Hide resolved
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

One last comment.

--
@hippo91 It would be great if you don't resolve review comments yourself. That makes it really difficult to see any comments you might add. Better to just add 👍🏻 and let the person who left the comment resolve it.
(Accepting suggestions is somewhat different as Github auto-resolves those. No need to unresolve them afterwards.)

from astroid import builder


@pytest.mark.skipif(not HAS_NUMPY, reason="This test requires the numpy library.")
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
@pytest.mark.skipif(not HAS_NUMPY, reason="This test requires the numpy library.")
@pytest.mark.skipif(HAS_NUMPY is False, reason="This test requires the numpy library.")

Technically the same. Might be just personal preference as this is how I think of it.

@cdce8p
Copy link
Member

cdce8p commented Sep 25, 2021

@hippo91 Could you rebase this PR onto main? It seems like there are again some unrelated commits in the history.

hippo91 and others added 9 commits September 25, 2021 12:45
to prevent nodes that are dynamically imported to be inferred through an
astroid's brain, the way it was done in builder.py was incorrect.
The way it was done, lead to prevent the use of astroid legetimate
brains even for node that was not dynamically loaded.
@hippo91
Copy link
Contributor Author

hippo91 commented Sep 25, 2021

@cdce8p it should be ok now. Sorry for that. I don't know what kind of mess i did with this branch.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 05445e2 into pylint-dev:main Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Brain 🧠 Needs a brain tip Bug 🪳 pylint-tested PRs that don't cause major regressions with pylint
Projects
None yet
4 participants