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: Fix an issue wherein importing numpy.typing could raise #19533

Merged
merged 3 commits into from Jul 22, 2021

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented Jul 21, 2021

closes #19521

Backport of #19525 in addition to two fixes for the to-be closed issue.


On a semi-frequent we're running into issues with numpy.typing when the following 2 conditions are met:

  • Python 3.7 is used.
  • typing-extensions is not installed.

Ideally we'd just run a CI job without typing-extensions installed and see if the tests run as expected
but unfortunately this is not possible, as it is an (indirect) hard dependency of pytest.

This PR instead opts for an alternative approach: the test introduced herein reloads the numpy.typing
submodules after manually invalidating typing-extensions, thus making the package inaccessible as if it
weren't installed in the first place.

@BvB93 BvB93 added this to the 1.21.2 release milestone Jul 21, 2021
@BvB93 BvB93 linked an issue Jul 21, 2021 that may be closed by this pull request
@BvB93 BvB93 changed the title BUG: Fix an issue wherein BUG: Fix an issue wherein import numpy.typing could raise Jul 21, 2021
@BvB93 BvB93 changed the title BUG: Fix an issue wherein import numpy.typing could raise BUG: Fix an issue wherein importing numpy.typing could raise Jul 21, 2021
@charris charris merged commit cfb451b into numpy:maintenance/1.21.x Jul 22, 2021
@charris
Copy link
Member

charris commented Jul 22, 2021

Thanks Bas.

@BvB93 BvB93 deleted the optional2 branch July 22, 2021 20:31
jjpr-mit added a commit to brain-score/brainio that referenced this pull request Jul 23, 2021
jjpr-mit added a commit to brain-score/brainio that referenced this pull request Jul 23, 2021
jjpr-mit added a commit to brain-score/brainio that referenced this pull request Jul 23, 2021
* main:
  numpy 1.21.1 introduced a bug:  numpy/numpy#19533 has the fix. (#8)
jjpr-mit added a commit to brain-score/brainio that referenced this pull request Mar 9, 2022
* main:
  Add documentation (#16)
  Handle catalog duplicates gracefully (#15)
  Update to keep track of catalog files. (#11)
  Some methods in xarray 0.19.0 return a DataArray where they used to return an appropriate subclass of DataAssembly. (#9)
  Travis badge (#7)
  numpy 1.21.1 introduced a bug:  numpy/numpy#19533 has the fix. (#8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing ArrayLike or DTypeLike raises a NameError in numpy 1.21.1
2 participants