]> granicus.if.org Git - python/commitdiff
#1535: rename __builtin__ module to builtins.
authorGeorg Brandl <georg@python.org>
Sun, 2 Dec 2007 09:40:06 +0000 (09:40 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 2 Dec 2007 09:40:06 +0000 (09:40 +0000)
70 files changed:
Demo/classes/Range.py
Demo/imputil/knee.py
Demo/pdist/client.py
Doc/c-api/init.rst
Doc/c-api/intro.rst
Doc/glossary.rst
Doc/library/builtins.rst [moved from Doc/library/__builtin__.rst with 83% similarity]
Doc/library/functions.rst
Doc/library/imputil.rst
Doc/library/python.rst
Doc/library/rlcompleter.rst
Doc/library/runpy.rst
Doc/library/sys.rst
Doc/reference/executionmodel.rst
Doc/reference/lexical_analysis.rst
Doc/reference/toplevel_components.rst
Doc/tutorial/classes.rst
Doc/tutorial/modules.rst
Include/object.h
Lib/aifc.py
Lib/codecs.py
Lib/dumbdbm.py
Lib/gettext.py
Lib/gzip.py
Lib/idlelib/ColorDelegator.py
Lib/idlelib/RemoteDebugger.py
Lib/ihooks.py
Lib/imputil.py
Lib/inspect.py
Lib/io.py
Lib/locale.py
Lib/optparse.py
Lib/pickletools.py
Lib/plat-mac/icopen.py
Lib/py_compile.py
Lib/pydoc.py
Lib/repr.py
Lib/rlcompleter.py
Lib/site.py
Lib/sunau.py
Lib/tarfile.py
Lib/test/pickletester.py
Lib/test/test_compile.py
Lib/test/test_exceptions.py
Lib/test/test_gettext.py
Lib/test/test_inspect.py
Lib/test/test_iterlen.py
Lib/test/test_pep352.py
Lib/test/test_site.py
Lib/test/test_sys.py
Lib/test/test_traceback.py
Lib/traceback.py
Lib/wave.py
Misc/Vim/vim_syntax.py
Modules/_bsddb.c
Modules/_lsprof.c
Modules/config.c.in
Objects/exceptions.c
Objects/listobject.c
Objects/typeobject.c
PC/bdist_wininst/install.c
PC/config.c
PC/os2emx/config.c
PC/os2vacpp/config.c
Python/bltinmodule.c
Python/errors.c
Python/import.c
Python/pythonrun.c
Python/sysmodule.c
Tools/freeze/makeconfig.py

index 0f84157aa2564b63115da517797ee0b77923b105..a0cef742088afa74cbeca526e2f23e051be15916 100755 (executable)
@@ -64,9 +64,9 @@ class oldrange:
 
 
 def test():
-    import time, __builtin__
+    import time, builtins
     #Just a quick sanity check
-    correct_result = __builtin__.range(5, 100, 3)
+    correct_result = builtins.range(5, 100, 3)
     oldrange_result = list(oldrange(5, 100, 3))
     genrange_result = list(genrange(5, 100, 3))
     if genrange_result != correct_result or oldrange_result != correct_result:
@@ -81,7 +81,7 @@ def test():
     for i in genrange(1000):
         pass
     t3 = time.time()
-    for i in __builtin__.range(1000):
+    for i in builtins.range(1000):
         pass
     t4 = time.time()
     print(t2-t1, 'sec (old-style class)')
index 49fdf2b7ae3b0a4b43da7d98c2ba33b018f1bfce..435b51c3ccd60bea26f3b6370532011248805f67 100644 (file)
@@ -7,7 +7,7 @@ This code is intended to be read, not executed.  However, it does work
 
 """
 
-import sys, imp, __builtin__
+import sys, imp, builtins
 
 
 # Replacement for __import__()
@@ -117,7 +117,7 @@ def reload(module):
 
 
 # Save the original hooks
-original_import = __builtin__.__import__
+original_import = builtins.__import__
 
 # Now install our hooks
-__builtin__.__import__ = import_hook
+builtins.__import__ = import_hook
index 13158f2a9638d2c3667a95cfb177be92f91af33f..c9fe369e2553a05e411339d724be074ce30cfb0d 100755 (executable)
@@ -3,7 +3,7 @@
 import sys
 import socket
 import pickle
-import __builtin__
+import builtins
 import os
 
 
@@ -90,8 +90,8 @@ class Client:
         if exception is None:
             return value
         x = exception
-        if hasattr(__builtin__, exception):
-            x = getattr(__builtin__, exception)
+        if hasattr(builtins, exception):
+            x = getattr(builtins, exception)
         elif exception in ('posix.error', 'mac.error'):
             x = os.error
         if x == exception:
index 0058e10bb7fbe486dc74e16adaca9e3e81096975..3467ed7b7845d3ef19512e51422a2bd48a9e05a6 100644 (file)
@@ -17,7 +17,7 @@ Initialization, Finalization, and Threads
       single: PyEval_AcquireLock()
       single: modules (in module sys)
       single: path (in module sys)
-      module: __builtin__
+      module: builtins
       module: __main__
       module: sys
       triple: module; search; path
@@ -29,7 +29,7 @@ Initialization, Finalization, and Threads
    exception of :cfunc:`Py_SetProgramName`, :cfunc:`PyEval_InitThreads`,
    :cfunc:`PyEval_ReleaseLock`, and :cfunc:`PyEval_AcquireLock`. This initializes
    the table of loaded modules (``sys.modules``), and creates the fundamental
-   modules :mod:`__builtin__`, :mod:`__main__` and :mod:`sys`.  It also initializes
+   modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`.  It also initializes
    the module search path (``sys.path``). It does not set ``sys.argv``; use
    :cfunc:`PySys_SetArgv` for that.  This is a no-op when called for a second time
    (without calling :cfunc:`Py_Finalize` first).  There is no return value; it is a
@@ -83,7 +83,7 @@ Initialization, Finalization, and Threads
 .. cfunction:: PyThreadState* Py_NewInterpreter()
 
    .. index::
-      module: __builtin__
+      module: builtins
       module: __main__
       module: sys
       single: stdout (in module sys)
@@ -93,7 +93,7 @@ Initialization, Finalization, and Threads
    Create a new sub-interpreter.  This is an (almost) totally separate environment
    for the execution of Python code.  In particular, the new interpreter has
    separate, independent versions of all imported modules, including the
-   fundamental modules :mod:`__builtin__`, :mod:`__main__` and :mod:`sys`.  The
+   fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`.  The
    table of loaded modules (``sys.modules``) and the module search path
    (``sys.path``) are also separate.  The new environment has no ``sys.argv``
    variable.  It has new standard I/O stream file objects ``sys.stdin``,
index 60b00521f4a9f25548f394553b73822eee23f081..0717241ea829f015c7fc65297261684f7528474e 100644 (file)
@@ -507,7 +507,7 @@ interpreter can only be used after the interpreter has been initialized.
 
 .. index::
    single: Py_Initialize()
-   module: __builtin__
+   module: builtins
    module: __main__
    module: sys
    module: exceptions
@@ -516,7 +516,7 @@ interpreter can only be used after the interpreter has been initialized.
 
 The basic initialization function is :cfunc:`Py_Initialize`. This initializes
 the table of loaded modules, and creates the fundamental modules
-:mod:`__builtin__`, :mod:`__main__`, :mod:`sys`, and :mod:`exceptions`.  It also
+:mod:`builtins`, :mod:`__main__`, :mod:`sys`, and :mod:`exceptions`.  It also
 initializes the module search path (``sys.path``).
 
 .. index:: single: PySys_SetArgv()
index aa698674512bceb326b08aacfb2a8c03c920e590..cb75f84b2a02eacc3229705d8d1e9cfaaf794aa8 100644 (file)
@@ -268,7 +268,7 @@ Glossary
       dictionaries.  There are the local, global and builtin namespaces as well
       as nested namespaces in objects (in methods).  Namespaces support
       modularity by preventing naming conflicts.  For instance, the functions
-      :func:`__builtin__.open` and :func:`os.open` are distinguished by their
+      :func:`builtins.open` and :func:`os.open` are distinguished by their
       namespaces.  Namespaces also aid readability and maintainability by making
       it clear which module implements a function.  For instance, writing
       :func:`random.seed` or :func:`itertools.izip` makes it clear that those
similarity index 83%
rename from Doc/library/__builtin__.rst
rename to Doc/library/builtins.rst
index b3e1e1188ddadfc51c4328d7d46203d407cdbce6..2a5c7f5144bf342efbaf72a85c6ad00b684a1405 100644 (file)
@@ -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 @@ but in which the built-in of that name is also needed.  For example, in a module
 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:
index 68601e5e9c81429fa3990d853812d2d7b1f34b00..5d0d8a5b7f3dadb27766a9360fa56c3b5923fbfe 100644 (file)
@@ -356,7 +356,7 @@ available.  They are listed here in alphabetical order.
    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 @@ available.  They are listed here in alphabetical order.
 
    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`.
 
index eff1cb90c95048da53aabf766d8fc02d2eab7c33..c05ae1a750501dbcdb4fe9eda617ebdb5f8eaaed 100644 (file)
@@ -108,7 +108,7 @@ This code is intended to be read, not executed.  However, it does work
 
 ::
 
-   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 @@ This code is intended to be read, not executed.  However, it does work
 
 
    # 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
index 33843224cef21b1b14f4295ad0064465c84a8f35..0fdfa53f72d86a29cbd0560e118f8a3151f45836 100644 (file)
@@ -13,7 +13,7 @@ overview:
 .. toctree::
 
    sys.rst
-   __builtin__.rst
+   builtins.rst
    __main__.rst
    warnings.rst
    contextlib.rst
index 402a1204550deb18bf6ea4fef6c11682431270f0..cec1e86a63759073a9e4d2e74accf9489970fb3b 100644 (file)
@@ -55,7 +55,7 @@ Completer objects have the following method:
    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
index d47687901d65d6ae4ae8326227eaac558ae059ec..2254906766d046a6e968d4b2982b991d0bc0e066 100644 (file)
@@ -46,7 +46,7 @@ The :mod:`runpy` module provides a single function:
    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
index 33de4f6aaf7776c7808c975acfee4c0213d02510..3b9112af74afabfc605efebf2397d17343ac9227 100644 (file)
@@ -78,7 +78,7 @@ always available.
 .. 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
index 1478cc75a8f0d0ac3946b2ce24336494025fa08b..1f85e49d4b3dc5fcdfcc1e7ba9542edad407ff6b 100644 (file)
@@ -105,7 +105,7 @@ If the :keyword:`global` statement occurs within a block, all uses of the name
 specified in the statement refer to the binding of that name in the top-level
 namespace.  Names are resolved in the top-level namespace by searching the
 global namespace, i.e. the namespace of the module containing the code block,
-and the builtin namespace, the namespace of the module :mod:`__builtin__`.  The
+and the builtin namespace, the namespace of the module :mod:`builtins`.  The
 global namespace is searched first.  If the name is not found there, the builtin
 namespace is searched.  The global statement must precede all uses of the name.
 
@@ -117,8 +117,8 @@ The built-in namespace associated with the execution of a code block is actually
 found by looking up the name ``__builtins__`` in its global namespace; this
 should be a dictionary or a module (in the latter case the module's dictionary
 is used).  By default, when in the :mod:`__main__` module, ``__builtins__`` is
-the built-in module :mod:`__builtin__` (note: no 's'); when in any other module,
-``__builtins__`` is an alias for the dictionary of the :mod:`__builtin__` module
+the built-in module :mod:`builtins`; when in any other module,
+``__builtins__`` is an alias for the dictionary of the :mod:`builtins` module
 itself.  ``__builtins__`` can be set to a user-created dictionary to create a
 weak form of restricted execution.
 
@@ -126,7 +126,7 @@ weak form of restricted execution.
 
    Users should not touch ``__builtins__``; it is strictly an implementation
    detail.  Users wanting to override values in the built-in namespace should
-   :keyword:`import` the :mod:`__builtin__` (no 's') module and modify its
+   :keyword:`import` the :mod:`builtins` module and modify its
    attributes appropriately.
 
 .. index:: module: __main__
index 1b315a648eade4fd6bd73ba2641f72c6dac2effa..741f8ecdc84ecee03019b06680b7f2cb7a400fa4 100644 (file)
@@ -344,7 +344,7 @@ characters:
 ``_*``
    Not imported by ``from module import *``.  The special identifier ``_`` is used
    in the interactive interpreter to store the result of the last evaluation; it is
-   stored in the :mod:`__builtin__` module.  When not in interactive mode, ``_``
+   stored in the :mod:`builtins` module.  When not in interactive mode, ``_``
    has no special meaning and is not defined. See section :ref:`import`.
 
    .. note::
index 0ab9aaff906940659891a6c6b33240854fc0a75c..21f801c5fa4e9c7cd5d3166a3693e6f687be771f 100644 (file)
@@ -23,13 +23,13 @@ Complete Python programs
 .. index::
    module: sys
    module: __main__
-   module: __builtin__
+   module: builtins
 
 While a language specification need not prescribe how the language interpreter
 is invoked, it is useful to have a notion of a complete Python program.  A
 complete Python program is executed in a minimally initialized environment: all
 built-in and standard modules are available, but none have been initialized,
-except for :mod:`sys` (various system services), :mod:`__builtin__` (built-in
+except for :mod:`sys` (various system services), :mod:`builtins` (built-in
 functions, exceptions and ``None``) and :mod:`__main__`.  The latter is used to
 provide the local and global namespace for execution of the complete program.
 
index 4e954195a0756a5e1b278014e218b5929e3fab0b..577c7e982c52f4600568e0e1ba13242e7b567650 100644 (file)
@@ -98,7 +98,7 @@ until the interpreter quits.  The statements executed by the top-level
 invocation of the interpreter, either read from a script file or interactively,
 are considered part of a module called :mod:`__main__`, so they have their own
 global namespace.  (The built-in names actually also live in a module; this is
-called :mod:`__builtin__`.)
+called :mod:`builtins`.)
 
 The local namespace for a function is created when the function is called, and
 deleted when the function returns or raises an exception that is not handled
index 4d8b48f69b10e46cbcce7a5863bb32898534e5c8..2a14b3561522212caf8bc4ef5dc43bbe5bdac918 100644 (file)
@@ -308,14 +308,14 @@ Without arguments, :func:`dir` lists the names you have defined currently::
 
 Note that it lists all types of names: variables, modules, functions, etc.
 
-.. index:: module: __builtin__
+.. index:: module: builtins
 
 :func:`dir` does not list the names of built-in functions and variables.  If you
 want a list of those, they are defined in the standard module
-:mod:`__builtin__`::
+:mod:`builtins`::
 
-   >>> import __builtin__
-   >>> dir(__builtin__)
+   >>> import builtins
+   >>> dir(builtins)
 
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer
    Error', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Excep   
index b5ed054a30ab180f00e982d2bc9d4837711a9a4e..942f801f63529e8546eb33efdcdcdcdcb9b6b808 100644 (file)
@@ -458,8 +458,8 @@ PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *);
 extern int _PyObject_SlotCompare(PyObject *, PyObject *);
 
 
-/* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a
-   list of strings.  PyObject_Dir(NULL) is like __builtin__.dir(),
+/* PyObject_Dir(obj) acts like Python builtins.dir(obj), returning a
+   list of strings.  PyObject_Dir(NULL) is like builtins.dir(),
    returning the names of the current locals.  In this case, if there are
    no current locals, NULL is returned, and PyErr_Occurred() is false.
 */
index 085fa90863a12670d4a7da967cac5a46738772f2..9b41c35128ea5ffab3a70974d6517975b8bc64cf 100644 (file)
@@ -135,7 +135,7 @@ writeframesraw.
 """
 
 import struct
-import __builtin__
+import builtins
 
 __all__ = ["Error","open","openfp"]
 
@@ -336,7 +336,7 @@ class Aifc_read:
 
     def __init__(self, f):
         if type(f) == type(''):
-            f = __builtin__.open(f, 'rb')
+            f = builtins.open(f, 'rb')
         # else, assume it is an open file object already
         self.initfp(f)
 
@@ -557,7 +557,7 @@ class Aifc_write:
     def __init__(self, f):
         if type(f) == type(''):
             filename = f
-            f = __builtin__.open(f, 'wb')
+            f = builtins.open(f, 'wb')
         else:
             # else, assume it is an open file object already
             filename = '???'
index 982c2825926ce53e7ef78d25a17d49c8a6697b16..06cec17a7c316b0178c7bcdd80f3ede8a05e972b 100644 (file)
@@ -7,7 +7,7 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
 
 """#"
 
-import __builtin__, sys
+import builtins, sys
 
 ### Registry and builtin stateless codec functions
 
@@ -858,7 +858,7 @@ def open(filename, mode='rb', encoding=None, errors='strict', buffering=1):
        'b' not in mode:
         # Force opening of the file in binary mode
         mode = mode + 'b'
-    file = __builtin__.open(filename, mode, buffering)
+    file = builtins.open(filename, mode, buffering)
     if encoding is None:
         return file
     info = lookup(encoding)
index 7741fbb83e8f02a7902103c0e262c2ac1c786e45..e44e1f5fd500d5270b645b029c93f838dd265d95 100644 (file)
@@ -23,7 +23,6 @@ is read when the database is opened, and some updates rewrite the whole index)
 
 import io as _io
 import os as _os
-import __builtin__
 import UserDict
 
 _BLOCKSIZE = 512
index be24f1dc62a9493f26024a8f630f94b6743905b6..6e14a9354a6620240fd8f20b0e7194241fa6033d 100644 (file)
@@ -236,18 +236,18 @@ class NullTranslations:
         self._output_charset = charset
 
     def install(self, str=False, names=None):
-        import __builtin__
-        __builtin__.__dict__['_'] = str and self.ugettext or self.gettext
+        import builtins
+        builtins.__dict__['_'] = str and self.ugettext or self.gettext
         if hasattr(names, "__contains__"):
             if "gettext" in names:
-                __builtin__.__dict__['gettext'] = __builtin__.__dict__['_']
+                builtins.__dict__['gettext'] = builtins.__dict__['_']
             if "ngettext" in names:
-                __builtin__.__dict__['ngettext'] = (str and self.ungettext
+                builtins.__dict__['ngettext'] = (str and self.ungettext
                                                              or self.ngettext)
             if "lgettext" in names:
-                __builtin__.__dict__['lgettext'] = self.lgettext
+                builtins.__dict__['lgettext'] = self.lgettext
             if "lngettext" in names:
-                __builtin__.__dict__['lngettext'] = self.lngettext
+                builtins.__dict__['lngettext'] = self.lngettext
 
 
 class GNUTranslations(NullTranslations):
index 4f750c068db6b4f978ad6f9fa829a269fa1dd371..a04408784edcb49950622ec42097fbe5ffcc9621 100644 (file)
@@ -7,7 +7,7 @@ but random access is not allowed."""
 
 import struct, sys, time
 import zlib
-import __builtin__
+import builtins
 
 __all__ = ["GzipFile","open"]
 
@@ -92,7 +92,7 @@ class GzipFile:
         if mode and 'b' not in mode:
             mode += 'b'
         if fileobj is None:
-            fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
+            fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
         if filename is None:
             if hasattr(fileobj, 'name'): filename = fileobj.name
             else: filename = ''
@@ -487,13 +487,13 @@ def _test():
                     print("filename doesn't end in .gz:", repr(arg))
                     continue
                 f = open(arg, "rb")
-                g = __builtin__.open(arg[:-3], "wb")
+                g = builtins.open(arg[:-3], "wb")
         else:
             if arg == "-":
                 f = sys.stdin
                 g = GzipFile(filename="", mode="wb", fileobj=sys.stdout)
             else:
-                f = __builtin__.open(arg, "rb")
+                f = builtins.open(arg, "rb")
                 g = open(arg + ".gz", "wb")
         while True:
             chunk = f.read(1024)
index b93aa5abb1a6986fdb2257b6ea0543a9b4d27f6f..e7112c93a0958191dd704e18ce6e14fc28c2e57b 100644 (file)
@@ -1,7 +1,7 @@
 import time
 import re
 import keyword
-import __builtin__
+import builtins
 from Tkinter import *
 from idlelib.Delegator import Delegator
 from idlelib.configHandler import idleConf
@@ -14,7 +14,7 @@ def any(name, alternates):
 
 def make_pat():
     kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b"
-    builtinlist = [str(name) for name in dir(__builtin__)
+    builtinlist = [str(name) for name in dir(builtins)
                                         if not name.startswith('_')]
     # self.file = open("file") :
     # 1st 'file' colorized normal, 2nd as builtin, 3rd as string
index e5b95b4e6ba785fb09d2f73a2e256ab1d721752f..46582d10ea7ff6ac40bd2a5a17abe1379f217627 100644 (file)
@@ -172,7 +172,7 @@ class IdbAdapter:
     def dict_item(self, did, key):
         dict = dicttable[did]
         value = dict[key]
-        value = repr(value) ### can't pickle module '__builtin__'
+        value = repr(value) ### can't pickle module 'builtins'
         return value
 
 #----------end class IdbAdapter----------
index d2eabc4cdd9fe0162bf14945e68b18388a575a25..433f51341a8e95fcb7c7f6030e2e60df540a5a9c 100644 (file)
@@ -49,7 +49,7 @@ by the way the __import__ hook is used by the Python interpreter.)
 """
 
 
-import __builtin__
+import builtins
 import imp
 import os
 import sys
@@ -375,18 +375,18 @@ class BasicModuleImporter(_Verbose):
         # XXX Should this try to clear the module's namespace?
 
     def install(self):
-        self.save_import_module = __builtin__.__import__
-        if not hasattr(__builtin__, 'unload'):
-            __builtin__.unload = None
-        self.save_unload = __builtin__.unload
-        __builtin__.__import__ = self.import_module
-        __builtin__.unload = self.unload
+        self.save_import_module = builtins.__import__
+        if not hasattr(builtins, 'unload'):
+            builtins.unload = None
+        self.save_unload = builtins.unload
+        builtins.__import__ = self.import_module
+        builtins.unload = self.unload
 
     def uninstall(self):
-        __builtin__.__import__ = self.save_import_module
-        __builtin__.unload = self.save_unload
-        if not __builtin__.unload:
-            del __builtin__.unload
+        builtins.__import__ = self.save_import_module
+        builtins.unload = self.save_unload
+        if not builtins.unload:
+            del builtins.unload
 
 
 class ModuleImporter(BasicModuleImporter):
index 1d09ba53085ce7ef200096a958c15cdc0bfe9038..4278e31d78de9275bc52b602115a7a0c2e8cdde1 100644 (file)
@@ -13,7 +13,7 @@ Exported classes:
 # note: avoid importing non-builtin modules
 import imp                      ### not available in JPython?
 import sys
-import __builtin__
+import builtins
 
 # for the DirectoryImporter
 import struct
@@ -26,7 +26,7 @@ _ModuleType = type(sys)         ### doesn't work in JPython...
 class ImportManager:
     "Manage the import process."
 
-    def install(self, namespace=vars(__builtin__)):
+    def install(self, namespace=vars(builtins)):
         "Install this ImportManager into the specified namespace."
 
         if isinstance(namespace, _ModuleType):
@@ -404,7 +404,7 @@ def _compile(pathname, timestamp):
     codestring = open(pathname, 'rU').read()
     if codestring and codestring[-1] != '\n':
         codestring = codestring + '\n'
-    code = __builtin__.compile(codestring, pathname, 'exec')
+    code = builtins.compile(codestring, pathname, 'exec')
 
     # try to cache the compiled code
     try:
index a1910e4ff960a165620647ae18cdc973c7d4a5e7..994dbdc51b4d4e61730b2fb1c5e80b10b9268d80 100644 (file)
@@ -444,7 +444,7 @@ def getmodule(object, _filename=None):
         if mainobject is object:
             return main
     # Check builtins
-    builtin = sys.modules['__builtin__']
+    builtin = sys.modules['builtins']
     if hasattr(builtin, object.__name__):
         builtinobject = getattr(builtin, object.__name__)
         if builtinobject is object:
@@ -775,7 +775,7 @@ def strseq(object, convert, join=joinseq):
 
 def formatannotation(annotation, base_module=None):
     if isinstance(annotation, type):
-        if annotation.__module__ in ('__builtin__', base_module):
+        if annotation.__module__ in ('builtins', base_module):
             return annotation.__name__
         return annotation.__module__+'.'+annotation.__name__
     return repr(annotation)
index f66f48bac3b97027e82e7236c6355b02ee1f00d8..ff039013254fce57df3b9ac435a1e6f53c3c86d8 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -184,7 +184,7 @@ def open(file, mode="r", buffering=None, encoding=None, newline=None,
 
 
 class OpenWrapper:
-    """Wrapper for __builtin__.open
+    """Wrapper for builtins.open
 
     Trick so that open won't become a bound method when stored
     as a class variable (as dumbdbm does).
index 3f30ca07ac2c26097fea19f17bc2fb872f6cca9b..ce0ca817eb138d5fdb43a22fffb2190581268dbf 100644 (file)
@@ -12,7 +12,7 @@
 """
 
 import sys, encodings, encodings.aliases
-from __builtin__ import str as _builtin_str
+from builtins import str as _builtin_str
 
 # Try importing the _locale module.
 #
index f702e1a845f84f037676ba5c2d3b284928d92e98..ab2ce40077e336fcc51648715f778fe046811059 100644 (file)
@@ -636,13 +636,13 @@ class Option:
         else:
             # Allow type objects or builtin type conversion functions
             # (int, str, etc.) as an alternative to their names.  (The
-            # complicated check of __builtin__ is only necessary for
+            # complicated check of builtins is only necessary for
             # Python 2.1 and earlier, and is short-circuited by the
             # first check on modern Pythons.)
-            import __builtin__
+            import builtins
             if ( isinstance(self.type, type) or
                  (hasattr(self.type, "__name__") and
-                  getattr(__builtin__, self.type.__name__, None) is self.type) ):
+                  getattr(builtins, self.type.__name__, None) is self.type) ):
                 self.type = self.type.__name__
 
             if self.type == "str":
index af84c1f8b9edd11bcacd86a571afb71f1382f656..0665cd0bcab1caee4d5a6ef477d271b54d3fa109 100644 (file)
@@ -2054,25 +2054,25 @@ highest protocol among opcodes = 0
    33: (    MARK
    34: c        GLOBAL     'pickletools _Example'
    56: p        PUT        2
-   59: c        GLOBAL     '__builtin__ object'
-   79: p        PUT        3
-   82: N        NONE
-   83: t        TUPLE      (MARK at 33)
-   84: p    PUT        4
-   87: R    REDUCE
-   88: p    PUT        5
-   91: (    MARK
-   92: d        DICT       (MARK at 91)
-   93: p    PUT        6
-   96: V    UNICODE    'value'
-  103: p    PUT        7
-  106: L    LONG       42
-  110: s    SETITEM
-  111: b    BUILD
-  112: a    APPEND
-  113: g    GET        5
-  116: a    APPEND
-  117: .    STOP
+   59: c        GLOBAL     'builtins object'
+   76: p        PUT        3
+   79: N        NONE
+   80: t        TUPLE      (MARK at 33)
+   81: p    PUT        4
+   84: R    REDUCE
+   85: p    PUT        5
+   88: (    MARK
+   89: d        DICT       (MARK at 88)
+   90: p    PUT        6
+   93: V    UNICODE    'value'
+  100: p    PUT        7
+  103: L    LONG       42
+  107: s    SETITEM
+  108: b    BUILD
+  109: a    APPEND
+  110: g    GET        5
+  113: a    APPEND
+  114: .    STOP
 highest protocol among opcodes = 0
 
 >>> dis(pickle.dumps(x, 1))
@@ -2084,23 +2084,23 @@ highest protocol among opcodes = 0
    31: (        MARK
    32: c            GLOBAL     'pickletools _Example'
    54: q            BINPUT     2
-   56: c            GLOBAL     '__builtin__ object'
-   76: q            BINPUT     3
-   78: N            NONE
-   79: t            TUPLE      (MARK at 31)
-   80: q        BINPUT     4
-   82: R        REDUCE
-   83: q        BINPUT     5
-   85: }        EMPTY_DICT
-   86: q        BINPUT     6
-   88: X        BINUNICODE 'value'
-   98: q        BINPUT     7
-  100: K        BININT1    42
-  102: s        SETITEM
-  103: b        BUILD
-  104: h        BINGET     5
-  106: e        APPENDS    (MARK at 3)
-  107: .    STOP
+   56: c            GLOBAL     'builtins object'
+   73: q            BINPUT     3
+   75: N            NONE
+   76: t            TUPLE      (MARK at 31)
+   77: q        BINPUT     4
+   79: R        REDUCE
+   80: q        BINPUT     5
+   82: }        EMPTY_DICT
+   83: q        BINPUT     6
+   85: X        BINUNICODE 'value'
+   95: q        BINPUT     7
+   97: K        BININT1    42
+   99: s        SETITEM
+  100: b        BUILD
+  101: h        BINGET     5
+  103: e        APPENDS    (MARK at 3)
+  104: .    STOP
 highest protocol among opcodes = 1
 
 Try "the canonical" recursive-object test.
index eea6083797539aae56664254926870cfeb2c36f4..146a333972343907563a2f2edcd93fa5c7eb32bc 100644 (file)
@@ -37,9 +37,9 @@ The next time you launch PythonInterpreter or Python IDE, the patch will take
 effect.
 """
 
-import __builtin__
+import builtins
 
-_builtin_open = globals().get('_builtin_open', __builtin__.open)
+_builtin_open = globals().get('_builtin_open', builtins.open)
 
 def _open_with_typer(*args):
     file = _builtin_open(*args)
@@ -55,7 +55,7 @@ def _open_with_typer(*args):
             pass
     return file
 
-__builtin__.open = _open_with_typer
+builtins.open = _open_with_typer
 
 """
 open('test.py')
index 912972bcac263f021bb3418500493eb90ebc16e1..982d19d1428efeaf37be4cc0d461e8e0935a437e 100644 (file)
@@ -3,7 +3,7 @@
 This module has intimate knowledge of the format of .pyc files.
 """
 
-import __builtin__
+import builtins
 import imp
 import marshal
 import os
@@ -139,7 +139,7 @@ def compile(file, cfile=None, dfile=None, doraise=False):
     if codestring and codestring[-1] != '\n':
         codestring = codestring + '\n'
     try:
-        codeobject = __builtin__.compile(codestring, dfile or file,'exec')
+        codeobject = builtins.compile(codestring, dfile or file,'exec')
     except Exception as err:
         py_exc = PyCompileError(err.__class__, err, dfile or file)
         if doraise:
index 51d627ea4dd43b53cddf8a89d6e02136fcf190f4..d94c3d30dacf884e274100faaa350f97d4dd282a 100755 (executable)
@@ -52,7 +52,7 @@ Richard Chamberlain, for the first implementation of textdoc.
 #     the current directory is changed with os.chdir(), an incorrect
 #     path will be displayed.
 
-import sys, imp, os, re, inspect, __builtin__, pkgutil
+import sys, imp, os, re, inspect, builtins, pkgutil
 from repr import Repr
 try:
     from collections import deque
@@ -787,7 +787,7 @@ class HTMLDoc(Doc):
                 thisclass = attrs[0][2]
             attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass)
 
-            if thisclass is __builtin__.object:
+            if thisclass is builtins.object:
                 attrs = inherited
                 continue
             elif thisclass is object:
@@ -1184,7 +1184,7 @@ class TextDoc(Doc):
                 thisclass = attrs[0][2]
             attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass)
 
-            if thisclass is __builtin__.object:
+            if thisclass is builtins.object:
                 attrs = inherited
                 continue
             elif thisclass is object:
@@ -1450,8 +1450,8 @@ def locate(path, forceload=0):
             except AttributeError: return None
         return object
     else:
-        if hasattr(__builtin__, path):
-            return getattr(__builtin__, path)
+        if hasattr(builtins, path):
+            return getattr(builtins, path)
 
 # --------------------------------------- interactive interpreter interface
 
index ceb36f9d730ebd0076062718b80c39ec645ff2e7..9893c71cb82b9112cdc6de87aabbaf8d4ca7de04 100644 (file)
@@ -2,7 +2,7 @@
 
 __all__ = ["Repr","repr"]
 
-import __builtin__
+import builtins
 from itertools import islice
 
 class Repr:
@@ -84,16 +84,16 @@ class Repr:
         return '{%s}' % (s,)
 
     def repr_str(self, x, level):
-        s = __builtin__.repr(x[:self.maxstring])
+        s = builtins.repr(x[:self.maxstring])
         if len(s) > self.maxstring:
             i = max(0, (self.maxstring-3)//2)
             j = max(0, self.maxstring-3-i)
-            s = __builtin__.repr(x[:i] + x[len(x)-j:])
+            s = builtins.repr(x[:i] + x[len(x)-j:])
             s = s[:i] + '...' + s[len(s)-j:]
         return s
 
     def repr_int(self, x, level):
-        s = __builtin__.repr(x) # XXX Hope this isn't too slow...
+        s = builtins.repr(x) # XXX Hope this isn't too slow...
         if len(s) > self.maxlong:
             i = max(0, (self.maxlong-3)//2)
             j = max(0, self.maxlong-3-i)
@@ -102,7 +102,7 @@ class Repr:
 
     def repr_instance(self, x, level):
         try:
-            s = __builtin__.repr(x)
+            s = builtins.repr(x)
             # Bugs in x.__repr__() can cause arbitrary
             # exceptions -- then make up something
         except Exception:
index 1c5750baa0242b341b9fc011db4ef5c031543f1c..74b2e47a81676f9f4333123c85fd010af5a62346 100644 (file)
@@ -33,7 +33,7 @@ used, and this module (and the readline module) are silently inactive.
 
 """
 
-import __builtin__
+import builtins
 import __main__
 
 __all__ = ["Completer"]
@@ -97,7 +97,7 @@ class Completer:
         matches = []
         n = len(text)
         for list in [keyword.kwlist,
-                     __builtin__.__dict__,
+                     builtins.__dict__,
                      self.namespace]:
             for word in list:
                 if word[:n] == text and word != "__builtins__":
index f1db89c9f0b2deefa095a11e85ac959927dcf427..b97f945aa673ee47cdcd08480a0efd2da7fc5d36 100644 (file)
@@ -60,7 +60,7 @@ ImportError exception, it is silently ignored.
 
 import sys
 import os
-import __builtin__
+import builtins
 
 
 def makepath(*paths):
@@ -251,8 +251,8 @@ def setquit():
             except:
                 pass
             raise SystemExit(code)
-    __builtin__.quit = Quitter('quit')
-    __builtin__.exit = Quitter('exit')
+    builtins.quit = Quitter('quit')
+    builtins.exit = Quitter('exit')
 
 
 class _Printer(object):
@@ -319,18 +319,18 @@ class _Printer(object):
                     break
 
 def setcopyright():
-    """Set 'copyright' and 'credits' in __builtin__"""
-    __builtin__.copyright = _Printer("copyright", sys.copyright)
+    """Set 'copyright' and 'credits' in builtins"""
+    builtins.copyright = _Printer("copyright", sys.copyright)
     if sys.platform[:4] == 'java':
-        __builtin__.credits = _Printer(
+        builtins.credits = _Printer(
             "credits",
             "Jython is maintained by the Jython developers (www.jython.org).")
     else:
-        __builtin__.credits = _Printer("credits", """\
+        builtins.credits = _Printer("credits", """\
     Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
     for supporting Python development.  See www.python.org for more information.""")
     here = os.path.dirname(os.__file__)
-    __builtin__.license = _Printer(
+    builtins.license = _Printer(
         "license", "See http://www.python.org/%.3s/license.html" % sys.version,
         ["LICENSE.txt", "LICENSE"],
         [os.path.join(here, os.pardir), here, os.curdir])
@@ -350,7 +350,7 @@ class _Helper(object):
         return pydoc.help(*args, **kwds)
 
 def sethelper():
-    __builtin__.help = _Helper()
+    builtins.help = _Helper()
 
 def aliasmbcs():
     """On Windows, some default encodings are not provided by Python,
index f2555025d9c648e9a72c138d679939984a4f45cb..b312501b35a42b96b1bb3b23556fda2550b0d232 100644 (file)
@@ -153,8 +153,8 @@ class Au_read:
 
     def __init__(self, f):
         if type(f) == type(''):
-            import __builtin__
-            f = __builtin__.open(f, 'rb')
+            import builtins
+            f = builtins.open(f, 'rb')
         self.initfp(f)
 
     def __del__(self):
@@ -282,8 +282,8 @@ class Au_write:
 
     def __init__(self, f):
         if type(f) == type(''):
-            import __builtin__
-            f = __builtin__.open(f, 'wb')
+            import builtins
+            f = builtins.open(f, 'wb')
         self.initfp(f)
 
     def __del__(self):
index 23252f4e61d4ce54377961e83407b99d9e23c499..f8afae9f5bee456bc19046cdd37210137ecd1410 100644 (file)
@@ -65,7 +65,7 @@ except ImportError:
 # from tarfile import *
 __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"]
 
-from __builtin__ import open as _open # Since 'open' is TarFile.open
+from builtins import open as _open # Since 'open' is TarFile.open
 
 #---------------------------------------------------------
 # tar constants
index 6db3572d3a9224595200701c9a9ccc131e3f5303..b20f599294b890da808b31e2bd66411da5cea71c 100644 (file)
@@ -91,7 +91,7 @@ class use_metaclass(object, metaclass=metaclass):
 
 DATA0 = (
     b'(lp0\nL0\naL1\naF2.0\nac'
-    b'__builtin__\ncomplex\n'
+    b'builtins\ncomplex\n'
     b'p1\n(F3.0\nF0.0\ntp2\nRp'
     b'3\naL1\naL-1\naL255\naL-'
     b'255\naL-256\naL65535\na'
@@ -100,8 +100,8 @@ DATA0 = (
     b'647\naL-2147483648\na('
     b'Vabc\np4\ng4\nccopy_reg'
     b'\n_reconstructor\np5\n('
-    b'c__main__\nC\np6\nc__bu'
-    b'iltin__\nobject\np7\nNt'
+    b'c__main__\nC\np6\ncbu'
+    b'iltins\nobject\np7\nNt'
     b'p8\nRp9\n(dp10\nVfoo\np1'
     b'1\nL1\nsVbar\np12\nL2\nsb'
     b'g9\ntp13\nag13\naL5\na.'
@@ -118,7 +118,7 @@ DATA0_DIS = """\
    12: a    APPEND
    13: F    FLOAT      2.0
    18: a    APPEND
-   19: c    GLOBAL     '__builtin__ complex'
+   19: c    GLOBAL     'builtins complex'
    40: p    PUT        1
    43: (    MARK
    44: F        FLOAT      3.0
@@ -159,7 +159,7 @@ DATA0_DIS = """\
   199: (        MARK
   200: c            GLOBAL     '__main__ C'
   212: p            PUT        6
-  215: c            GLOBAL     '__builtin__ object'
+  215: c            GLOBAL     'builtins object'
   235: p            PUT        7
   238: N            NONE
   239: t            TUPLE      (MARK at 199)
@@ -191,15 +191,15 @@ highest protocol among opcodes = 0
 """
 
 DATA1 = (
-    b']q\x00(K\x00K\x01G@\x00\x00\x00\x00\x00\x00\x00c__'
-    b'builtin__\ncomplex\nq\x01'
+    b']q\x00(K\x00K\x01G@\x00\x00\x00\x00\x00\x00\x00c'
+    b'builtins\ncomplex\nq\x01'
     b'(G@\x08\x00\x00\x00\x00\x00\x00G\x00\x00\x00\x00\x00\x00\x00\x00t'
     b'q\x02Rq\x03K\x01J\xff\xff\xff\xffK\xffJ\x01\xff\xff\xffJ'
     b'\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff'
     b'\xff\x7fJ\x01\x00\x00\x80J\x00\x00\x00\x80(X\x03\x00\x00\x00ab'
     b'cq\x04h\x04ccopy_reg\n_reco'
     b'nstructor\nq\x05(c__main'
-    b'__\nC\nq\x06c__builtin__\n'
+    b'__\nC\nq\x06cbuiltins\n'
     b'object\nq\x07Ntq\x08Rq\t}q\n('
     b'X\x03\x00\x00\x00fooq\x0bK\x01X\x03\x00\x00\x00bar'
     b'q\x0cK\x02ubh\ttq\rh\rK\x05e.'
@@ -213,7 +213,7 @@ DATA1_DIS = """\
     4: K        BININT1    0
     6: K        BININT1    1
     8: G        BINFLOAT   2.0
-   17: c        GLOBAL     '__builtin__ complex'
+   17: c        GLOBAL     'builtins complex'
    38: q        BINPUT     1
    40: (        MARK
    41: G            BINFLOAT   3.0
@@ -242,7 +242,7 @@ DATA1_DIS = """\
   152: (            MARK
   153: c                GLOBAL     '__main__ C'
   165: q                BINPUT     6
-  167: c                GLOBAL     '__builtin__ object'
+  167: c                GLOBAL     'builtins object'
   187: q                BINPUT     7
   189: N                NONE
   190: t                TUPLE      (MARK at 152)
@@ -272,7 +272,7 @@ highest protocol among opcodes = 1
 
 DATA2 = (
     b'\x80\x02]q\x00(K\x00K\x01G@\x00\x00\x00\x00\x00\x00\x00c'
-    b'__builtin__\ncomplex\n'
+    b'builtins\ncomplex\n'
     b'q\x01G@\x08\x00\x00\x00\x00\x00\x00G\x00\x00\x00\x00\x00\x00\x00\x00'
     b'\x86q\x02Rq\x03K\x01J\xff\xff\xff\xffK\xffJ\x01\xff\xff\xff'
     b'J\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff'
@@ -292,7 +292,7 @@ DATA2_DIS = """\
     6: K        BININT1    0
     8: K        BININT1    1
    10: G        BINFLOAT   2.0
-   19: c        GLOBAL     '__builtin__ complex'
+   19: c        GLOBAL     'builtins complex'
    40: q        BINPUT     1
    42: G        BINFLOAT   3.0
    51: G        BINFLOAT   0.0
index e7ffc02b7d7439046eaedb8d912a2be87ec81054..cc490d722fc4935aa9ddf98aaaf21448dd2c11f3 100644 (file)
@@ -7,10 +7,10 @@ class TestSpecifics(unittest.TestCase):
     def test_debug_assignment(self):
         # catch assignments to __debug__
         self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single')
-        import __builtin__
-        prev = __builtin__.__debug__
-        setattr(__builtin__, '__debug__', 'sure')
-        setattr(__builtin__, '__debug__', prev)
+        import builtins
+        prev = builtins.__debug__
+        setattr(builtins, '__debug__', 'sure')
+        setattr(builtins, '__debug__', prev)
 
     def test_argument_handling(self):
         # detect duplicate positional and keyword arguments
index d1f9b1a9db9cef0c49695e71cca30b0618b37495..ae4687f17dfaedcd4724909f2358aa9992682035 100644 (file)
@@ -288,7 +288,7 @@ class ExceptionTests(unittest.TestCase):
                 raise
             else:
                 # Verify module name
-                self.assertEquals(type(e).__module__, '__builtin__')
+                self.assertEquals(type(e).__module__, 'builtins')
                 # Verify no ref leaks in Exc_str()
                 s = str(e)
                 for checkArgName in expected:
index 12a657cb7837c078f231851b4f6d7ae2eb02bc05..a875272bd3e28d26bac60eda7b7941cfd39228ac 100644 (file)
@@ -146,13 +146,13 @@ trggrkg zrffntr pngnybt yvoenel.''')
         t.install(str=True)
         eq(_('mullusk'), 'bacon')
         # Test installation of other methods
-        import __builtin__
+        import builtins
         t.install(str=True, names=["gettext", "lgettext"])
         eq(_, t.ugettext)
-        eq(__builtin__.gettext, t.ugettext)
+        eq(builtins.gettext, t.ugettext)
         eq(lgettext, t.lgettext)
-        del __builtin__.gettext
-        del __builtin__.lgettext
+        del builtins.gettext
+        del builtins.lgettext
 
 
 class GettextTestCase2(GettextBaseTest):
index 60a7ad1817d611f6249ee880a11821e6308e66a1..75e66ed9a17964e3d3d9cf7e3b644efd96d965cd 100644 (file)
@@ -29,7 +29,7 @@ modfile = normcase(modfile)
 def revise(filename, *args):
     return (normcase(filename),) + args
 
-import __builtin__
+import builtins
 
 try:
     1/0
@@ -197,7 +197,7 @@ class TestRetrievingSourceCode(GetSourceBase):
         # Do it again (check the caching isn't broken)
         self.assertEqual(inspect.getmodule(mod.StupidGit.abuse), mod)
         # Check a builtin
-        self.assertEqual(inspect.getmodule(str), sys.modules["__builtin__"])
+        self.assertEqual(inspect.getmodule(str), sys.modules["builtins"])
         # Check filename override
         self.assertEqual(inspect.getmodule(None, modfile), mod)
 
index afd7287aa78b65d77b29fb790787fe7b4def8e25..93b77b606a2079cd23b9b684214fe84e7a4746bb 100644 (file)
@@ -46,7 +46,7 @@ from test import test_support
 from itertools import repeat
 from collections import deque
 from UserList import UserList
-from __builtin__ import len as _len
+from builtins import len as _len
 
 n = 10
 
index ddeee1a1b7fcad9a397002c018f7bb42e3c9662a..db117ef2a85d2e7ea9c0e86b664bdc9d28b27ad3 100644 (file)
@@ -1,5 +1,5 @@
 import unittest
-import __builtin__
+import builtins
 import warnings
 from test.test_support import run_unittest
 import os
@@ -23,7 +23,7 @@ class ExceptionClassTests(unittest.TestCase):
     def test_inheritance(self):
         # Make sure the inheritance hierarchy matches the documentation
         exc_set = set()
-        for object_ in __builtin__.__dict__.values():
+        for object_ in builtins.__dict__.values():
             try:
                 if issubclass(object_, BaseException):
                     exc_set.add(object_.__name__)
@@ -35,7 +35,7 @@ class ExceptionClassTests(unittest.TestCase):
         try:
             superclass_name = inheritance_tree.readline().rstrip()
             try:
-                last_exc = getattr(__builtin__, superclass_name)
+                last_exc = getattr(builtins, superclass_name)
             except AttributeError:
                 self.fail("base class %s not a built-in" % superclass_name)
             self.failUnless(superclass_name in exc_set,
@@ -58,7 +58,7 @@ class ExceptionClassTests(unittest.TestCase):
                     left_bracket = exc_name.index('[')
                     exc_name = exc_name[:left_bracket-1]  # cover space
                 try:
-                    exc = getattr(__builtin__, exc_name)
+                    exc = getattr(builtins, exc_name)
                 except AttributeError:
                     self.fail("%s not a built-in exception" % exc_name)
                 if last_depth < depth:
index 11bb674a34778bf044022f276787902a9547a370..4624ea6276c0642a86080b08d59f7285dada8e86 100644 (file)
@@ -6,7 +6,7 @@ executing have not been removed.
 """
 import unittest
 from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN
-import __builtin__
+import builtins
 import os
 import sys
 import encodings
@@ -162,7 +162,7 @@ class ImportSideEffectTests(unittest.TestCase):
         # as an absolute path.
         # Handled by abs__file__()
         site.abs__file__()
-        for module in (sys, os, __builtin__):
+        for module in (sys, os, builtins):
             try:
                 self.failUnless(os.path.isabs(module.__file__), repr(module))
             except AttributeError:
@@ -187,18 +187,18 @@ class ImportSideEffectTests(unittest.TestCase):
         pass
 
     def test_setting_quit(self):
-        # 'quit' and 'exit' should be injected into __builtin__
-        self.failUnless(hasattr(__builtin__, "quit"))
-        self.failUnless(hasattr(__builtin__, "exit"))
+        # 'quit' and 'exit' should be injected into builtins
+        self.failUnless(hasattr(builtins, "quit"))
+        self.failUnless(hasattr(builtins, "exit"))
 
     def test_setting_copyright(self):
-        # 'copyright' and 'credits' should be in __builtin__
-        self.failUnless(hasattr(__builtin__, "copyright"))
-        self.failUnless(hasattr(__builtin__, "credits"))
+        # 'copyright' and 'credits' should be in builtins
+        self.failUnless(hasattr(builtins, "copyright"))
+        self.failUnless(hasattr(builtins, "credits"))
 
     def test_setting_help(self):
-        # 'help' should be set in __builtin__
-        self.failUnless(hasattr(__builtin__, "help"))
+        # 'help' should be set in builtins
+        self.failUnless(hasattr(builtins, "help"))
 
     def test_aliasing_mbcs(self):
         if sys.platform == "win32":
index 767f3a803d339c73e575b230bdbd9a12a51cae68..435a6968cbeb02220fcec27c0f618f52aa9f27f8 100644 (file)
@@ -15,22 +15,22 @@ class SysModuleTest(unittest.TestCase):
         sys.displayhook = self.orig_displayhook
 
     def test_original_displayhook(self):
-        import __builtin__
+        import builtins
         out = io.StringIO()
         sys.stdout = out
 
         dh = sys.__displayhook__
 
         self.assertRaises(TypeError, dh)
-        if hasattr(__builtin__, "_"):
-            del __builtin__._
+        if hasattr(builtins, "_"):
+            del builtins._
 
         dh(None)
         self.assertEqual(out.getvalue(), "")
-        self.assert_(not hasattr(__builtin__, "_"))
+        self.assert_(not hasattr(builtins, "_"))
         dh(42)
         self.assertEqual(out.getvalue(), "42\n")
-        self.assertEqual(__builtin__._, 42)
+        self.assertEqual(builtins._, 42)
 
         del sys.stdout
         self.assertRaises(RuntimeError, dh, 42)
index 36ea06782f0128ca170ad5cc65ffc4e38b8956b4..93e512601d5aa387e0df344d314ea21111e7d3aa 100644 (file)
@@ -65,7 +65,7 @@ class TracebackCases(unittest.TestCase):
         err = traceback.format_exception_only(X, X())
         self.assertEqual(len(err), 1)
         str_value = '<unprintable %s object>' % X.__name__
-        if X.__module__ in ('__main__', '__builtin__'):
+        if X.__module__ in ('__main__', 'builtins'):
             str_name = X.__name__
         else:
             str_name = '.'.join([X.__module__, X.__name__])
index 11ece25ca61f12fc9e1712d393379b92da365e2f..0c01ac3bc9c5b4ff692d203fbf87a5c2b902de3b 100644 (file)
@@ -168,7 +168,7 @@ def format_exception_only(etype, value):
 
     stype = etype.__name__
     smod = etype.__module__
-    if smod not in ("__main__", "__builtin__"):
+    if smod not in ("__main__", "builtins"):
         stype = smod + '.' + stype
 
     if not issubclass(etype, SyntaxError):
index eda3697144407637139cdfbb02e4eecfe5944525..8455522f8fc57284b3352cce2e99957b333d0b39 100644 (file)
@@ -71,7 +71,7 @@ The close() method is called automatically when the class instance
 is destroyed.
 """
 
-import __builtin__
+import builtins
 
 __all__ = ["open", "openfp", "Error"]
 
@@ -156,7 +156,7 @@ class Wave_read:
     def __init__(self, f):
         self._i_opened_the_file = None
         if isinstance(f, str):
-            f = __builtin__.open(f, 'rb')
+            f = builtins.open(f, 'rb')
             self._i_opened_the_file = f
         # else, assume it is an open file object already
         try:
@@ -300,7 +300,7 @@ class Wave_write:
     def __init__(self, f):
         self._i_opened_the_file = None
         if isinstance(f, str):
-            f = __builtin__.open(f, 'wb')
+            f = builtins.open(f, 'wb')
             self._i_opened_the_file = f
         try:
             self.initfp(f)
index 3212bf4eacd36572c1aa4770e19c7869fbb71b03..14c551271588aaa705bb83b0d46caeb6c0c8e41a 100644 (file)
@@ -4,7 +4,7 @@ from __future__ import with_statement
 
 import keyword
 import exceptions
-import __builtin__
+import builtins
 from string import Template
 
 comment_header = '''" Auto-generated Vim syntax file for Python.
@@ -39,7 +39,7 @@ exception_names = sorted(exc for exc in dir(exceptions)
 # nothing that comes with modules (e.g., __name__), so just exclude anything in
 # the 'exceptions' module since we want to ignore exceptions *and* what any
 # module would have
-builtin_names = sorted(builtin for builtin in dir(__builtin__)
+builtin_names = sorted(builtin for builtin in dir(builtins)
                             if builtin not in dir(exceptions))
 
 escapes = (r'+\\[abfnrtv\'"\\]+', r'"\\\o\{1,3}"', r'"\\x\x\{2}"',
index 0587071c2d9e4b9b179046e600ce5e7da8a68aa6..24f25627ce59016231754dd3d2bdc43790447aa0 100644 (file)
@@ -6002,7 +6002,7 @@ PyMODINIT_FUNC init_bsddb(void)
      * using one base class. */
     PyDict_SetItemString(d, "KeyError", PyExc_KeyError);
     { 
-           PyObject *builtin_mod = PyImport_ImportModule("__builtin__");
+           PyObject *builtin_mod = PyImport_ImportModule("builtins");
            PyDict_SetItemString(d, "__builtins__", builtin_mod);
     }
     PyRun_String("class DBNotFoundError(DBError, KeyError): pass\n"
index 7e85dcf8d4bd79de3ed5a8bb0735bce43aef9159..1707679e6ee24d2c75675f3b9fd8c5c1feaa35f4 100644 (file)
@@ -186,13 +186,13 @@ normalizeUserObj(PyObject *obj)
                        modname = PyModule_GetName(mod);
                        if (modname == NULL) {
                                PyErr_Clear();
-                               modname = "__builtin__";
+                               modname = "builtins";
                        }
                }
                else {
-                       modname = "__builtin__";
+                       modname = "builtins";
                }
-               if (strcmp(modname, "__builtin__") != 0)
+               if (strcmp(modname, "builtins") != 0)
                        return PyUnicode_FromFormat("<%s.%s>",
                                                    modname,
                                                    fn->m_ml->ml_name);
index e9c54a9bdbe8762a521bdd4cf463c9a02bdfea8a..0531fab6bb039485c82065032ba49f10ee9cb8a1 100644 (file)
@@ -48,7 +48,7 @@ struct _inittab _PyImport_Inittab[] = {
 
        /* These entries are here for sys.builtin_module_names */
        {"__main__", NULL},
-       {"__builtin__", NULL},
+       {"builtins", NULL},
        {"sys", NULL},
 
        /* This lives in gcmodule.c */
index e26c35041c1ec65df336b907deb09c0ee1ef5988..14e1bfb0c75e6f3b5b759cc73f53aceb44ccc8ab 100644 (file)
@@ -1849,7 +1849,7 @@ _PyExc_Init(void)
     PRE_INIT(UnicodeWarning)
     PRE_INIT(BytesWarning)
 
-    bltinmod = PyImport_ImportModule("__builtin__");
+    bltinmod = PyImport_ImportModule("builtins");
     if (bltinmod == NULL)
         Py_FatalError("exceptions bootstrapping error.");
     bdict = PyModule_GetDict(bltinmod);
index ea10abf4cf05d31f0231229abe0706ae4ddabce9..01ada08282d9425c8777d6635ec29d1c8ff2ee84 100644 (file)
@@ -1961,7 +1961,7 @@ is_default_cmp(PyObject *cmpfunc)
        module = PyUnicode_AsString(f->m_module);
        if (module == NULL)
                return 0;
-       if (strcmp(module, "__builtin__") != 0)
+       if (strcmp(module, "builtins") != 0)
                return 0;
        if (strcmp(f->m_ml->ml_name, "cmp") != 0)
                return 0;
index fd6f5ce2b6c95f47026c28d2b28282cd8929249c..99ba7998f8e91a13fb5a6cbd302ccf06ca6efc8b 100644 (file)
@@ -112,7 +112,7 @@ type_module(PyTypeObject *type, void *context)
                if (s != NULL)
                        return PyUnicode_FromStringAndSize(
                            type->tp_name, (Py_ssize_t)(s - type->tp_name));
-               return PyUnicode_FromString("__builtin__");
+               return PyUnicode_FromString("builtins");
        }
 }
 
@@ -397,7 +397,7 @@ type_repr(PyTypeObject *type)
        else
                kind = "type";
 
-       if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "__builtin__"))
+       if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins"))
                rtn = PyUnicode_FromFormat("<%s '%U.%U'>", kind, mod, name);
        else
                rtn = PyUnicode_FromFormat("<%s '%s'>", kind, type->tp_name);
@@ -2455,7 +2455,7 @@ object_repr(PyObject *self)
        name = type_name(type, NULL);
        if (name == NULL)
                return NULL;
-       if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "__builtin__"))
+       if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins"))
                rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self);
        else
                rtn = PyUnicode_FromFormat("<%s object at %p>",
index 0ce2371a771d8dedde2df300fd7828a2ac94233f..3f7d774615f79fc34475f08b09f8d182be72a3d8 100644 (file)
@@ -654,7 +654,7 @@ static int prepare_script_environment(HINSTANCE hPython)
        if (!Py_BuildValue || !PyArg_ParseTuple || !PyErr_Format)
                return 1;
 
-       mod = PyImport_ImportModule("__builtin__");
+       mod = PyImport_ImportModule("builtins");
        if (mod) {
                int i;
                g_PyExc_ValueError = PyObject_GetAttrString(mod, "ValueError");
index 63ff2c019bc5e1861cb8e38e672b8af8b4ce2a94..fee254a099af2994ab3ed15fbe43421d88b01c16 100644 (file)
@@ -143,7 +143,7 @@ struct _inittab _PyImport_Inittab[] = {
 
         /* These entries are here for sys.builtin_module_names */
         {"__main__", NULL},
-        {"__builtin__", NULL},
+        {"builtins", NULL},
         {"sys", NULL},
         
         {"_types", init_types},
index 352442941b92775a1fe9464e75489a06b249d6e1..47378fd5c381a832d09b69ed20d1de3d735079d0 100644 (file)
@@ -156,7 +156,7 @@ struct _inittab _PyImport_Inittab[] = {
 
        /* These entries are here for sys.builtin_module_names */
        {"__main__", NULL},
-       {"__builtin__", NULL},
+       {"builtins", NULL},
        {"sys", NULL},
 
        /* This lives in gcmodule.c */
index 62bb8b28ab0be0fe822d4defe315da56f3576dea..7be2b0bcf8c8065173b1ea6b12d1976b4c037513 100644 (file)
@@ -94,7 +94,7 @@ struct _inittab _PyImport_Inittab[] = {
 
         /* These entries are here for sys.builtin_module_names */
         {"__main__", NULL},
-        {"__builtin__", NULL},
+        {"builtins", NULL},
         {"sys", NULL},
 
         /* Sentinel */
index fb7e223367ee2fce8214844fedbe4286ca84c6bf..053e083a4bb7ec195fc28dbfd8ae01872283dbf9 100644 (file)
@@ -1851,7 +1851,7 @@ PyObject *
 _PyBuiltin_Init(void)
 {
        PyObject *mod, *dict, *debug;
-       mod = Py_InitModule4("__builtin__", builtin_methods,
+       mod = Py_InitModule4("builtins", builtin_methods,
                             builtin_doc, (PyObject *)NULL,
                             PYTHON_API_VERSION);
        if (mod == NULL)
@@ -1859,7 +1859,7 @@ _PyBuiltin_Init(void)
        dict = PyModule_GetDict(mod);
 
 #ifdef Py_TRACE_REFS
-       /* __builtin__ exposes a number of statically allocated objects
+       /* "builtins" exposes a number of statically allocated objects
         * that, before this code was added in 2.3, never showed up in
         * the list of "all objects" maintained by Py_TRACE_REFS.  As a
         * result, programs leaking references to None and False (etc)
index 1cd5dfdadab4a767d26c02fb209637a508ca556b..063187bf51ff4fffe02976c5fee9dcc5d62fd163 100644 (file)
@@ -645,7 +645,7 @@ PyErr_WriteUnraisable(PyObject *obj)
                        else {
                                char* modstr = PyUnicode_AsString(moduleName);
                                if (modstr &&
-                                   strcmp(modstr, "__builtin__") != 0)
+                                   strcmp(modstr, "builtins") != 0)
                                {
                                        PyFile_WriteString(modstr, f);
                                        PyFile_WriteString(".", f);
index 1ea92975e23c3d87011b2f64bac154ae11b00df8..419f3e9043a8d4bae000651d8e84425529cd1169 100644 (file)
@@ -400,11 +400,11 @@ PyImport_Cleanup(void)
           deleted *last* of all, they would come too late in the normal
           destruction order.  Sigh. */
 
-       value = PyDict_GetItemString(modules, "__builtin__");
+       value = PyDict_GetItemString(modules, "builtins");
        if (value != NULL && PyModule_Check(value)) {
                dict = PyModule_GetDict(value);
                if (Py_VerboseFlag)
-                       PySys_WriteStderr("# clear __builtin__._\n");
+                       PySys_WriteStderr("# clear builtins._\n");
                PyDict_SetItemString(dict, "_", Py_None);
        }
        value = PyDict_GetItemString(modules, "sys");
@@ -436,11 +436,11 @@ PyImport_Cleanup(void)
                PyDict_SetItemString(modules, "__main__", Py_None);
        }
 
-       /* The special treatment of __builtin__ here is because even
+       /* The special treatment of "builtins" here is because even
           when it's not referenced as a module, its dictionary is
           referenced by almost every module's __builtins__.  Since
           deleting a module clears its dictionary (even if there are
-          references left to it), we need to delete the __builtin__
+          references left to it), we need to delete the "builtins"
           module last.  Likewise, we don't delete sys until the very
           end because it is implicitly referenced (e.g. by print).
 
@@ -451,7 +451,7 @@ PyImport_Cleanup(void)
           re-imported. */
 
        /* Next, repeatedly delete modules with a reference count of
-          one (skipping __builtin__ and sys) and delete them */
+          one (skipping builtins and sys) and delete them */
        do {
                ndone = 0;
                pos = 0;
@@ -460,7 +460,7 @@ PyImport_Cleanup(void)
                                continue;
                        if (PyUnicode_Check(key) && PyModule_Check(value)) {
                                name = PyUnicode_AsString(key);
-                               if (strcmp(name, "__builtin__") == 0)
+                               if (strcmp(name, "builtins") == 0)
                                        continue;
                                if (strcmp(name, "sys") == 0)
                                        continue;
@@ -474,12 +474,12 @@ PyImport_Cleanup(void)
                }
        } while (ndone > 0);
 
-       /* Next, delete all modules (still skipping __builtin__ and sys) */
+       /* Next, delete all modules (still skipping builtins and sys) */
        pos = 0;
        while (PyDict_Next(modules, &pos, &key, &value)) {
                if (PyUnicode_Check(key) && PyModule_Check(value)) {
                        name = PyUnicode_AsString(key);
-                       if (strcmp(name, "__builtin__") == 0)
+                       if (strcmp(name, "builtins") == 0)
                                continue;
                        if (strcmp(name, "sys") == 0)
                                continue;
@@ -490,7 +490,7 @@ PyImport_Cleanup(void)
                }
        }
 
-       /* Next, delete sys and __builtin__ (in that order) */
+       /* Next, delete sys and builtins (in that order) */
        value = PyDict_GetItemString(modules, "sys");
        if (value != NULL && PyModule_Check(value)) {
                if (Py_VerboseFlag)
@@ -498,12 +498,12 @@ PyImport_Cleanup(void)
                _PyModule_Clear(value);
                PyDict_SetItemString(modules, "sys", Py_None);
        }
-       value = PyDict_GetItemString(modules, "__builtin__");
+       value = PyDict_GetItemString(modules, "builtins");
        if (value != NULL && PyModule_Check(value)) {
                if (Py_VerboseFlag)
-                       PySys_WriteStderr("# cleanup __builtin__\n");
+                       PySys_WriteStderr("# cleanup builtins\n");
                _PyModule_Clear(value);
-               PyDict_SetItemString(modules, "__builtin__", Py_None);
+               PyDict_SetItemString(modules, "builtins", Py_None);
        }
 
        /* Finally, clear and delete the modules directory */
@@ -2491,7 +2491,7 @@ PyImport_Import(PyObject *module_name)
                /* No globals -- use standard builtins, and fake globals */
                PyErr_Clear();
 
-               builtins = PyImport_ImportModuleLevel("__builtin__",
+               builtins = PyImport_ImportModuleLevel("builtins",
                                                      NULL, NULL, NULL, 0);
                if (builtins == NULL)
                        return NULL;
index 08b0d834ce310afc8c137fb4370f36a8a3cb4722..d1a062b9508361cc718e2159dce4404f851b74c7 100644 (file)
@@ -211,7 +211,7 @@ Py_InitializeEx(int install_sigs)
 
        bimod = _PyBuiltin_Init();
        if (bimod == NULL)
-               Py_FatalError("Py_Initialize: can't initialize __builtin__");
+               Py_FatalError("Py_Initialize: can't initialize builtins modules");
        interp->builtins = PyModule_GetDict(bimod);
        if (interp->builtins == NULL)
                Py_FatalError("Py_Initialize: can't initialize builtins dict");
@@ -243,7 +243,7 @@ Py_InitializeEx(int install_sigs)
        _PyImport_Init();
 
        /* phase 2 of builtins */
-       _PyImport_FixupExtension("__builtin__", "__builtin__");
+       _PyImport_FixupExtension("builtins", "builtins");
 
        _PyImportHooks_Init();
 
@@ -572,7 +572,7 @@ Py_NewInterpreter(void)
        interp->modules = PyDict_New();
        interp->modules_reloading = PyDict_New();
 
-       bimod = _PyImport_FindExtension("__builtin__", "__builtin__");
+       bimod = _PyImport_FindExtension("builtins", "builtins");
        if (bimod != NULL) {
                interp->builtins = PyModule_GetDict(bimod);
                if (interp->builtins == NULL)
@@ -682,7 +682,7 @@ initmain(void)
                Py_FatalError("can't create __main__ module");
        d = PyModule_GetDict(m);
        if (PyDict_GetItemString(d, "__builtins__") == NULL) {
-               PyObject *bimod = PyImport_ImportModule("__builtin__");
+               PyObject *bimod = PyImport_ImportModule("builtins");
                if (bimod == NULL ||
                    PyDict_SetItemString(d, "__builtins__", bimod) != 0)
                        Py_FatalError("can't add __builtins__ to __main__");
@@ -717,7 +717,7 @@ initsite(void)
        }
 }
 
-/* Initialize sys.stdin, stdout, stderr and __builtin__.open */
+/* Initialize sys.stdin, stdout, stderr and builtins.open */
 static int
 initstdio(void)
 {
@@ -739,7 +739,7 @@ initstdio(void)
        }
        Py_DECREF(m);
 
-       if (!(bimod = PyImport_ImportModule("__builtin__"))) {
+       if (!(bimod = PyImport_ImportModule("builtins"))) {
                goto error;
        }
 
@@ -750,7 +750,7 @@ initstdio(void)
                goto error;
        }
 
-       /* Set __builtin__.open */
+       /* Set builtins.open */
        if (PyObject_SetAttrString(bimod, "open", wrapper) == -1) {
                goto error;
        }
@@ -1362,7 +1362,7 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
                        }
                        else {
                                char* modstr = PyUnicode_AsString(moduleName);
-                               if (modstr && strcmp(modstr, "__builtin__"))
+                               if (modstr && strcmp(modstr, "builtins"))
                                {
                                        err = PyFile_WriteString(modstr, f);
                                        err += PyFile_WriteString(".", f);
index 6f68e00ff612b5e98bba472e7e91ff6422da6750..e793707d38ef0633ede325d9059475211385347b 100644 (file)
@@ -72,10 +72,10 @@ sys_displayhook(PyObject *self, PyObject *o)
        PyObject *outf;
        PyInterpreterState *interp = PyThreadState_GET()->interp;
        PyObject *modules = interp->modules;
-       PyObject *builtins = PyDict_GetItemString(modules, "__builtin__");
+       PyObject *builtins = PyDict_GetItemString(modules, "builtins");
 
        if (builtins == NULL) {
-               PyErr_SetString(PyExc_RuntimeError, "lost __builtin__");
+               PyErr_SetString(PyExc_RuntimeError, "lost builtins module");
                return NULL;
        }
 
@@ -106,7 +106,7 @@ sys_displayhook(PyObject *self, PyObject *o)
 PyDoc_STRVAR(displayhook_doc,
 "displayhook(object) -> None\n"
 "\n"
-"Print an object to sys.stdout and also save it in __builtin__.\n"
+"Print an object to sys.stdout and also save it in builtins.\n"
 );
 
 static PyObject *
@@ -896,7 +896,7 @@ __excepthook__ -- the original excepthook; don't touch!\n\
 \n\
 Functions:\n\
 \n\
-displayhook() -- print an object to the screen, and save it in __builtin__._\n\
+displayhook() -- print an object to the screen, and save it in builtins._\n\
 excepthook() -- print an exception and its traceback to sys.stderr\n\
 exc_info() -- return thread-safe information about the current exception\n\
 exit() -- exit the interpreter by raising SystemExit\n\
index 0bf8756d84e16f3459ed821b76a97e46e7b34502..e2a181ce194637ecf745170ee92e85f3406124c7 100644 (file)
@@ -3,7 +3,7 @@ import re
 
 # Write the config.c file
 
-never = ['marshal', '__main__', '__builtin__', 'sys', 'exceptions']
+never = ['marshal', '__main__', 'builtins', 'sys', 'exceptions']
 
 def makeconfig(infp, outfp, modules, with_ifdef=0):
     m1 = re.compile('-- ADDMODULE MARKER 1 --')