Skip to content

API: Hide exceptions from the main namespace#22735

Merged
mattip merged 2 commits intonumpy:mainfrom
seberg:hide-exceptions
Dec 7, 2022
Merged

API: Hide exceptions from the main namespace#22735
mattip merged 2 commits intonumpy:mainfrom
seberg:hide-exceptions

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented Dec 5, 2022

I wasn't sure if we should already start deprecating the exceptions so opted to follow up with only hiding them from __dir__() but still having them in __all__ and available.

This also changes their module to numpy.exceptions, which matters because that is how they will be pickled (it would not be possible to unpickle such an exception in an older NumPy version).

Due to pickling, we could put off changing the module.

@rgommers
Copy link
Copy Markdown
Member

rgommers commented Dec 5, 2022

Hiding but not yet deprecating seems right to me.

@seberg
Copy link
Copy Markdown
Member Author

seberg commented Dec 5, 2022

Ah, I should follow up with a scan for changing the current uses at least in documentation, and also internal uses. But maybe its actually nice to keep it as distinct PRs.

I wasn't sure if we should already start deprecating the exceptions
so opted to follow up with only hiding them from `__dir__()` but
still having them in `__all__` and available.

This also changes their module to `numpy.exceptions`, which matters
because that is how they will be pickled (it would not be possible
to unpickle such an exception in an older NumPy version).

Due to pickling, we could put off changing the module.
@mattip mattip merged commit 4d5c3bf into numpy:main Dec 7, 2022
@mattip
Copy link
Copy Markdown
Member

mattip commented Dec 7, 2022

Thanks @seberg

@seberg seberg deleted the hide-exceptions branch December 7, 2022 08:57
seberg added a commit to seberg/numpy that referenced this pull request Dec 13, 2022
The first one should have been removed in numpygh-22735, the second an even more
random find.
rossbar pushed a commit that referenced this pull request Dec 13, 2022
The first one should have been removed in gh-22735, the second an even more
random find.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants