Skip to content

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

Merged
charris merged 1 commit into
numpy:masterfrom
mwtoews:builtin
Jan 24, 2020
Merged

MAINT, DOC: Remove use of old Python __builtin__, now known as builtins#15418
charris merged 1 commit into
numpy:masterfrom
mwtoews:builtin

Conversation

@mwtoews

@mwtoews mwtoews commented Jan 24, 2020

Copy link
Copy Markdown
Contributor

Python 2's __builtin__ module is replaced with the builtins module.

A few notes:

  • See gh-6103 for planned DEP to numpy/__init__.py, which are not touched here, just re-arranged to remove Python 2 logic
  • Not sure if "See also" link in numpy/core/defchararray.py will work in Sphinx outputs (the current __builtin__.len does not link)
  • Removed a 14-year-old "hmm," comment (44f0e40) that does not make sense for the current form of numpy/distutils/misc_util.py.

@mwtoews mwtoews changed the title MAINT/DOC: Remove use of old Python __builtin__, now known as builtins MAINT, DOC: Remove use of old Python __builtin__, now known as builtins Jan 24, 2020
Comment thread numpy/__init__.py
else:
from __builtin__ import bool, int, float, complex, object, unicode, str
from builtins import bool, int, float, complex, object, str
unicode = str

Copy link
Copy Markdown
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.

@charris charris merged commit b5fa352 into numpy:master Jan 24, 2020
@charris

charris commented Jan 24, 2020

Copy link
Copy Markdown
Member

Thanks @mwtoews .

@mwtoews mwtoews deleted the builtin branch March 9, 2021 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants