#1535: rename __builtin__ module to builtins.
diff --git a/Doc/library/__builtin__.rst b/Doc/library/builtins.rst
similarity index 83%
rename from Doc/library/__builtin__.rst
rename to Doc/library/builtins.rst
index b3e1e11..2a5c7f5 100644
--- a/Doc/library/__builtin__.rst
+++ b/Doc/library/builtins.rst
@@ -1,13 +1,13 @@
-:mod:`__builtin__` --- Built-in objects
-=======================================
+:mod:`builtins` --- Built-in objects
+====================================
-.. module:: __builtin__
+.. module:: builtins
:synopsis: The module that provides the built-in namespace.
This module provides direct access to all 'built-in' identifiers of Python; for
-example, ``__builtin__.open`` is the full name for the built-in function
+example, ``builtins.open`` is the full name for the built-in function
:func:`open`. See chapter :ref:`builtin`.
This module is not normally accessed explicitly by most applications, but can be
@@ -16,10 +16,10 @@
that wants to implement an :func:`open` function that wraps the built-in
:func:`open`, this module can be used directly::
- import __builtin__
+ import builtins
def open(path):
- f = __builtin__.open(path, 'r')
+ f = builtins.open(path, 'r')
return UpperCaser(f)
class UpperCaser:
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 68601e5..5d0d8a5 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -356,7 +356,7 @@
dictionaries as global and local namespace. If the *globals* dictionary is
present and lacks '__builtins__', the current globals are copied into *globals*
before *expression* is parsed. This means that *expression* normally has full
- access to the standard :mod:`__builtin__` module and restricted environments are
+ access to the standard :mod:`builtins` module and restricted environments are
propagated. If the *locals* dictionary is omitted it defaults to the *globals*
dictionary. If both dictionaries are omitted, the expression is executed in the
environment where :keyword:`eval` is called. The return value is the result of
@@ -398,7 +398,7 @@
If the *globals* dictionary does not contain a value for the key
``__builtins__``, a reference to the dictionary of the built-in module
- :mod:`__builtin__` is inserted under that key. That way you can control what
+ :mod:`builtins` is inserted under that key. That way you can control what
builtins are available to the executed code by inserting your own
``__builtins__`` dictionary into *globals* before passing it to :func:`exec`.
diff --git a/Doc/library/imputil.rst b/Doc/library/imputil.rst
index eff1cb9..c05ae1a 100644
--- a/Doc/library/imputil.rst
+++ b/Doc/library/imputil.rst
@@ -108,7 +108,7 @@
::
- import sys, imp, __builtin__
+ import sys, imp, builtins
# Replacement for __import__()
def import_hook(name, globals=None, locals=None, fromlist=None):
@@ -218,12 +218,12 @@
# Save the original hooks
- original_import = __builtin__.__import__
- original_reload = __builtin__.reload
+ original_import = builtins.__import__
+ original_reload = builtins.reload
# Now install our hooks
- __builtin__.__import__ = import_hook
- __builtin__.reload = reload_hook
+ builtins.__import__ = import_hook
+ builtins.reload = reload_hook
.. index::
module: knee
diff --git a/Doc/library/python.rst b/Doc/library/python.rst
index 3384322..0fdfa53 100644
--- a/Doc/library/python.rst
+++ b/Doc/library/python.rst
@@ -13,7 +13,7 @@
.. toctree::
sys.rst
- __builtin__.rst
+ builtins.rst
__main__.rst
warnings.rst
contextlib.rst
diff --git a/Doc/library/rlcompleter.rst b/Doc/library/rlcompleter.rst
index 402a120..cec1e86 100644
--- a/Doc/library/rlcompleter.rst
+++ b/Doc/library/rlcompleter.rst
@@ -55,7 +55,7 @@
Return the *state*th completion for *text*.
If called for *text* that doesn't include a period character (``'.'``), it will
- complete from names currently defined in :mod:`__main__`, :mod:`__builtin__` and
+ complete from names currently defined in :mod:`__main__`, :mod:`builtins` and
keywords (as defined by the :mod:`keyword` module).
If called for a dotted name, it will try to evaluate anything without obvious
diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst
index d476879..2254906 100644
--- a/Doc/library/runpy.rst
+++ b/Doc/library/runpy.rst
@@ -46,7 +46,7 @@
does not make filename information available, this variable is set to ``None``.
``__builtins__`` is automatically initialised with a reference to the top level
- namespace of the :mod:`__builtin__` module.
+ namespace of the :mod:`builtins` module.
If the argument *alter_sys* is supplied and evaluates to ``True``, then
``sys.argv[0]`` is updated with the value of ``__file__`` and
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 33de4f6..3b9112a 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -78,7 +78,7 @@
.. function:: displayhook(value)
If *value* is not ``None``, this function prints it to ``sys.stdout``, and saves
- it in ``__builtin__._``.
+ it in ``builtins._``.
``sys.displayhook`` is called on the result of evaluating an expression entered
in an interactive Python session. The display of these values can be customized