-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: set correct __module__ for objects in numpy's public API #12382
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
Conversation
Fixes numpyGH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
'set_string_function': 'numpy.core.arrayprint.set_string_function', | ||
'show_config': 'numpy.__config__.show', | ||
'str': 'builtins.str', | ||
'unicode': 'builtins.str', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you group together the builtins aliases, perhaps even as a separate dictionary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
45253eb
to
fc73a3b
Compare
The downside is that it is harder to find the actual location. Oh, well, there is still grep. Seems like something that could use a mention in the release notes, but I can't figure where :) Maybe compatibility notes? |
I actually already wrote release notes for this as part of one of my |
OK, in it goes. Thanks Stephan. |
This appears to have broken PyPy support (#12740), since PyPy treats |
Fixes #12271
Tests verify that everything in
dir(numpy)
either has__module__
set to'numpy'
, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed.I also identified a handful of functions for which I had accidentally not setup dispatch for with
__array_function__
before, mostly because they were listed under "ndarray methods" in_add_newdocs.py
. I guess that should be a lesson in trusting code comments :).