8000 MAINT, DOC: Remove use of old Python __builtin__, now known as builtins by mwtoews · Pull Request #15418 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT, DOC: Remove use of old Python __builtin__, now known as builtins #15418

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

Merged
merged 1 commit into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,8 @@
# Make these accessible from numpy name-space
# but not imported in from numpy import *
# TODO[gh-6103]: Deprecate these
if sys.version_info[0] >= 3:
from builtins import bool, int, float, complex, object, str
unicode = str
else:
from __builtin__ import bool, int, float, complex, object, unicode, str
from builtins import bool, int, float, complex, object, str
unicode = str
Copy link
Member

Choose a reason for hiding this comment

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

unicode is also defined in np.compat. We may want to deal with that at some point. It is unfortunate that it is part of the default numpy api.


from .core import round, abs, max, min
# now that numpy modules are imported, can initialize limits
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/defchararray.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def str_len(a):

See also
--------
__builtin__.len
builtins.len
"""
return _vec_string(a, integer, '__len__')

Expand Down
1 change: 0 additions & 1 deletion numpy/distutils/misc_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def get_path_from_frame(frame, parent_path=None):
# we're probably running setup.py as execfile("setup.py")
# (likely we're building an egg)
d = os.path.abspath('.')
# hmm, should we use sys.argv[0] like in __builtin__ case?

if parent_path is not None:
d = rel_path(d, parent_path)
Expand Down
0