Index: Python/ceval.c =================================================================== --- Python/ceval.c (revision 57016) +++ Python/ceval.c (working copy) @@ -1606,7 +1606,7 @@ break; case LOAD_BUILD_CLASS: - x = PyDict_GetItemString(f->f_builtins, + x = PyDict_GetItemString(f->f_builtin, "__build_class__"); if (x == NULL) { PyErr_SetString(PyExc_ImportError, @@ -1748,7 +1748,7 @@ if (x == NULL) { x = PyDict_GetItem(f->f_globals, w); if (x == NULL) { - x = PyDict_GetItem(f->f_builtins, w); + x = PyDict_GetItem(f->f_builtin, w); if (x == NULL) { format_exc_check_arg( PyExc_NameError, @@ -1783,7 +1783,7 @@ PUSH(x); continue; } - d = (PyDictObject *)(f->f_builtins); + d = (PyDictObject *)(f->f_builtin); e = d->ma_lookup(d, w, hash); if (e == NULL) { x = NULL; @@ -1801,7 +1801,7 @@ /* This is the un-inlined version of the code above */ x = PyDict_GetItem(f->f_globals, w); if (x == NULL) { - x = PyDict_GetItem(f->f_builtins, w); + x = PyDict_GetItem(f->f_builtin, w); if (x == NULL) { load_global_error: format_exc_check_arg( @@ -1977,7 +1977,7 @@ case IMPORT_NAME: w = GETITEM(names, oparg); - x = PyDict_GetItemString(f->f_builtins, "__import__"); + x = PyDict_GetItemString(f->f_builtin, "__import__"); if (x == NULL) { PyErr_SetString(PyExc_ImportError, "__import__ not found"); @@ -3333,9 +3333,9 @@ { PyFrameObject *current_frame = PyEval_GetFrame(); if (current_frame == NULL) - return PyThreadState_GET()->interp->builtins; + return PyThreadState_GET()->interp->builtin; else - return current_frame->f_builtins; + return current_frame->f_builtin; } PyObject * @@ -3622,7 +3622,7 @@ assert(globals != NULL); /* XXX Perhaps we should create a specialized PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. + take builtin without sanity checking them. */ assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); Index: Python/pystate.c =================================================================== --- Python/pystate.c (revision 57016) +++ Python/pystate.c (working copy) @@ -70,7 +70,7 @@ interp->modules = NULL; interp->modules_reloading = NULL; interp->sysdict = NULL; - interp->builtins = NULL; + interp->builtin = NULL; interp->tstate_head = NULL; interp->codec_search_path = NULL; interp->codec_search_cache = NULL; @@ -110,7 +110,7 @@ Py_CLEAR(interp->modules); Py_CLEAR(interp->modules_reloading); Py_CLEAR(interp->sysdict); - Py_CLEAR(interp->builtins); + Py_CLEAR(interp->builtin); } Index: Python/pythonrun.c =================================================================== --- Python/pythonrun.c (revision 57016) +++ Python/pythonrun.c (working copy) @@ -210,10 +210,10 @@ bimod = _PyBuiltin_Init(); if (bimod == NULL) Py_FatalError("Py_Initialize: can't initialize __builtin__"); - interp->builtins = PyModule_GetDict(bimod); - if (interp->builtins == NULL) - Py_FatalError("Py_Initialize: can't initialize builtins dict"); - Py_INCREF(interp->builtins); + interp->builtin = PyModule_GetDict(bimod); + if (interp->builtin == NULL) + Py_FatalError("Py_Initialize: can't initialize builtin dict"); + Py_INCREF(interp->builtin); sysmod = _PySys_Init(); if (sysmod == NULL) @@ -232,7 +232,7 @@ /* initialize builtin exceptions */ _PyExc_Init(); - /* phase 2 of builtins */ + /* phase 2 of builtin */ _PyImport_FixupExtension("__builtin__", "__builtin__"); _PyImportHooks_Init(); @@ -535,10 +535,10 @@ bimod = _PyImport_FindExtension("__builtin__", "__builtin__"); if (bimod != NULL) { - interp->builtins = PyModule_GetDict(bimod); - if (interp->builtins == NULL) + interp->builtin = PyModule_GetDict(bimod); + if (interp->builtin == NULL) goto handle_error; - Py_INCREF(interp->builtins); + Py_INCREF(interp->builtin); } sysmod = _PyImport_FindExtension("sys", "sys"); if (bimod != NULL && sysmod != NULL) { @@ -642,11 +642,11 @@ if (m == NULL) Py_FatalError("can't create __main__ module"); d = PyModule_GetDict(m); - if (PyDict_GetItemString(d, "__builtins__") == NULL) { + if (PyDict_GetItemString(d, "__builtin__") == NULL) { PyObject *bimod = PyImport_ImportModule("__builtin__"); if (bimod == NULL || - PyDict_SetItemString(d, "__builtins__", bimod) != 0) - Py_FatalError("can't add __builtins__ to __main__"); + PyDict_SetItemString(d, "__builtin__", bimod) != 0) + Py_FatalError("can't add __builtin__ to __main__"); Py_DECREF(bimod); } } Index: Python/import.c =================================================================== --- Python/import.c (revision 57016) +++ Python/import.c (working copy) @@ -442,7 +442,7 @@ /* The special treatment of __builtin__ here is because even when it's not referenced as a module, its dictionary is - referenced by almost every module's __builtins__. Since + referenced by almost every module's __builtin__. Since deleting a module clears its dictionary (even if there are references left to it), we need to delete the __builtin__ module last. Likewise, we don't delete sys until the very @@ -652,8 +652,8 @@ /* If the module is being reloaded, we get the old module back and re-use its dict to exec the new code. */ d = PyModule_GetDict(m); - if (PyDict_GetItemString(d, "__builtins__") == NULL) { - if (PyDict_SetItemString(d, "__builtins__", + if (PyDict_GetItemString(d, "__builtin__") == NULL) { + if (PyDict_SetItemString(d, "__builtin__", PyEval_GetBuiltins()) != 0) goto error; } @@ -2530,7 +2530,7 @@ /* Higher-level import emulator which emulates the "import" statement more accurately -- it invokes the __import__() function from the - builtins of the current globals. This means that the import is + builtin of the current globals. This means that the import is done using whatever import hooks are installed in the current environment, e.g. by "rexec". A dummy list ["__doc__"] is passed as the 4th argument so that @@ -2541,11 +2541,11 @@ PyImport_Import(PyObject *module_name) { static PyObject *silly_list = NULL; - static PyObject *builtins_str = NULL; + static PyObject *builtin_str = NULL; static PyObject *import_str = NULL; PyObject *globals = NULL; PyObject *import = NULL; - PyObject *builtins = NULL; + PyObject *builtin = NULL; PyObject *r = NULL; /* Initialize constant string objects */ @@ -2553,43 +2553,43 @@ import_str = PyUnicode_InternFromString("__import__"); if (import_str == NULL) return NULL; - builtins_str = PyUnicode_InternFromString("__builtins__"); - if (builtins_str == NULL) + builtin_str = PyUnicode_InternFromString("__builtin__"); + if (builtin_str == NULL) return NULL; silly_list = Py_BuildValue("[s]", "__doc__"); if (silly_list == NULL) return NULL; } - /* Get the builtins from current globals */ + /* Get the builtin from current globals */ globals = PyEval_GetGlobals(); if (globals != NULL) { Py_INCREF(globals); - builtins = PyObject_GetItem(globals, builtins_str); - if (builtins == NULL) + builtin = PyObject_GetItem(globals, builtin_str); + if (builtin == NULL) goto err; } else { - /* No globals -- use standard builtins, and fake globals */ + /* No globals -- use standard builtin, and fake globals */ PyErr_Clear(); - builtins = PyImport_ImportModuleLevel("__builtin__", + builtin = PyImport_ImportModuleLevel("__builtin__", NULL, NULL, NULL, 0); - if (builtins == NULL) + if (builtin == NULL) return NULL; - globals = Py_BuildValue("{OO}", builtins_str, builtins); + globals = Py_BuildValue("{OO}", builtin_str, builtin); if (globals == NULL) goto err; } - /* Get the __import__ function from the builtins */ - if (PyDict_Check(builtins)) { - import = PyObject_GetItem(builtins, import_str); + /* Get the __import__ function from the builtin */ + if (PyDict_Check(builtin)) { + import = PyObject_GetItem(builtin, import_str); if (import == NULL) PyErr_SetObject(PyExc_KeyError, import_str); } else - import = PyObject_GetAttr(builtins, import_str); + import = PyObject_GetAttr(builtin, import_str); if (import == NULL) goto err; @@ -2599,7 +2599,7 @@ err: Py_XDECREF(globals); - Py_XDECREF(builtins); + Py_XDECREF(builtin); Py_XDECREF(import); return r; Index: Python/bltinmodule.c =================================================================== --- Python/bltinmodule.c (revision 57016) +++ Python/bltinmodule.c (working copy) @@ -517,8 +517,8 @@ return NULL; } - if (PyDict_GetItemString(globals, "__builtins__") == NULL) { - if (PyDict_SetItemString(globals, "__builtins__", + if (PyDict_GetItemString(globals, "__builtin__") == NULL) { + if (PyDict_SetItemString(globals, "__builtin__", PyEval_GetBuiltins()) != 0) return NULL; } @@ -599,8 +599,8 @@ locals->ob_type->tp_name); return NULL; } - if (PyDict_GetItemString(globals, "__builtins__") == NULL) { - if (PyDict_SetItemString(globals, "__builtins__", + if (PyDict_GetItemString(globals, "__builtin__") == NULL) { + if (PyDict_SetItemString(globals, "__builtin__", PyEval_GetBuiltins()) != 0) return NULL; } Index: Python/sysmodule.c =================================================================== --- Python/sysmodule.c (revision 57016) +++ Python/sysmodule.c (working copy) @@ -76,9 +76,9 @@ PyObject *outf; PyInterpreterState *interp = PyThreadState_GET()->interp; PyObject *modules = interp->modules; - PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); + PyObject *builtin = PyDict_GetItemString(modules, "__builtin__"); - if (builtins == NULL) { + if (builtin == NULL) { PyErr_SetString(PyExc_RuntimeError, "lost __builtin__"); return NULL; } @@ -90,7 +90,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyObject_SetAttrString(builtins, "_", Py_None) != 0) + if (PyObject_SetAttrString(builtin, "_", Py_None) != 0) return NULL; outf = PySys_GetObject("stdout"); if (outf == NULL) { @@ -101,7 +101,7 @@ return NULL; if (PyFile_WriteString("\n", outf) != 0) return NULL; - if (PyObject_SetAttrString(builtins, "_", o) != 0) + if (PyObject_SetAttrString(builtin, "_", o) != 0) return NULL; Py_INCREF(Py_None); return Py_None; Index: Include/pystate.h =================================================================== --- Include/pystate.h (revision 57016) +++ Include/pystate.h (working copy) @@ -20,7 +20,7 @@ PyObject *modules; PyObject *sysdict; - PyObject *builtins; + PyObject *builtin; PyObject *modules_reloading; PyObject *codec_search_path; Index: Include/frameobject.h =================================================================== --- Include/frameobject.h (revision 57016) +++ Include/frameobject.h (working copy) @@ -17,7 +17,7 @@ PyObject_VAR_HEAD struct _frame *f_back; /* previous frame, or NULL */ PyCodeObject *f_code; /* code segment */ - PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ + PyObject *f_builtin; /* builtin symbol table (PyDictObject) */ PyObject *f_globals; /* global symbol table (PyDictObject) */ PyObject *f_locals; /* local symbol table (any mapping) */ PyObject **f_valuestack; /* points after the last local */ Index: Demo/pysvr/pysvr.c =================================================================== --- Demo/pysvr/pysvr.c (revision 57016) +++ Demo/pysvr/pysvr.c (working copy) @@ -214,7 +214,7 @@ static PyThreadState *the_tstate; static PyInterpreterState *the_interp; -static PyObject *the_builtins; +static PyObject *the_builtin; static void init_python(void) Index: Objects/dictobject.c =================================================================== --- Objects/dictobject.c (revision 57016) +++ Objects/dictobject.c (working copy) @@ -2355,7 +2355,7 @@ * support more set operations * support arbitrary mappings? - either these should be static or exported in dictobject.h - - if public then they should probably be in builtins + - if public then they should probably be in builtin */ /* Forward */ Index: Objects/boolobject.c =================================================================== --- Objects/boolobject.c (revision 57016) +++ Objects/boolobject.c (working copy) @@ -86,7 +86,7 @@ "bool(x) -> bool\n\ \n\ Returns True when the argument x is true, False otherwise.\n\ -The builtins True and False are the only two instances of the class bool.\n\ +The builtin True and False are the only two instances of the class bool.\n\ The class bool is a subclass of the class int, and cannot be subclassed."); /* Arithmetic methods -- only so we can override &, |, ^. */ Index: Objects/moduleobject.c =================================================================== --- Objects/moduleobject.c (revision 57016) +++ Objects/moduleobject.c (working copy) @@ -130,12 +130,12 @@ } } - /* Next, clear all names except for __builtins__ */ + /* Next, clear all names except for __builtin__ */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { if (value != Py_None && PyString_Check(key)) { char *s = PyString_AsString(key); - if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { + if (s[0] != '_' || strcmp(s, "__builtin__") != 0) { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[2] %s\n", s); PyDict_SetItem(d, key, Py_None); @@ -143,9 +143,9 @@ } } - /* Note: we leave __builtins__ in place, so that destructors + /* Note: we leave __builtin__ in place, so that destructors of non-global objects defined in this module can still use - builtins, in particularly 'None'. */ + builtin, in particularly 'None'. */ } Index: Objects/frameobject.c =================================================================== --- Objects/frameobject.c (revision 57016) +++ Objects/frameobject.c (working copy) @@ -17,7 +17,7 @@ static PyMemberDef frame_memberlist[] = { {"f_back", T_OBJECT, OFF(f_back), READONLY}, {"f_code", T_OBJECT, OFF(f_code), READONLY}, - {"f_builtins", T_OBJECT, OFF(f_builtins),READONLY}, + {"f_builtin", T_OBJECT, OFF(f_builtin),READONLY}, {"f_globals", T_OBJECT, OFF(f_globals), READONLY}, {"f_lasti", T_INT, OFF(f_lasti), READONLY}, {"f_exc_type", T_OBJECT, OFF(f_exc_type)}, @@ -416,7 +416,7 @@ } Py_XDECREF(f->f_back); - Py_DECREF(f->f_builtins); + Py_DECREF(f->f_builtin); Py_DECREF(f->f_globals); Py_CLEAR(f->f_locals); Py_CLEAR(f->f_trace); @@ -447,7 +447,7 @@ Py_VISIT(f->f_back); Py_VISIT(f->f_code); - Py_VISIT(f->f_builtins); + Py_VISIT(f->f_builtin); Py_VISIT(f->f_globals); Py_VISIT(f->f_locals); Py_VISIT(f->f_trace); @@ -541,7 +541,7 @@ int _PyFrame_Init() { - builtin_object = PyUnicode_InternFromString("__builtins__"); + builtin_object = PyUnicode_InternFromString("__builtin__"); return (builtin_object != NULL); } @@ -551,7 +551,7 @@ { PyFrameObject *back = tstate->frame; PyFrameObject *f; - PyObject *builtins; + PyObject *builtin; Py_ssize_t i; #ifdef Py_DEBUG @@ -562,34 +562,34 @@ } #endif if (back == NULL || back->f_globals != globals) { - builtins = PyDict_GetItem(globals, builtin_object); - if (builtins) { - if (PyModule_Check(builtins)) { - builtins = PyModule_GetDict(builtins); - assert(!builtins || PyDict_Check(builtins)); + builtin = PyDict_GetItem(globals, builtin_object); + if (builtin) { + if (PyModule_Check(builtin)) { + builtin = PyModule_GetDict(builtin); + assert(!builtin || PyDict_Check(builtin)); } - else if (!PyDict_Check(builtins)) - builtins = NULL; + else if (!PyDict_Check(builtin)) + builtin = NULL; } - if (builtins == NULL) { - /* No builtins! Make up a minimal one + if (builtin == NULL) { + /* No builtin! Make up a minimal one Give them 'None', at least. */ - builtins = PyDict_New(); - if (builtins == NULL || + builtin = PyDict_New(); + if (builtin == NULL || PyDict_SetItemString( - builtins, "None", Py_None) < 0) + builtin, "None", Py_None) < 0) return NULL; } else - Py_INCREF(builtins); + Py_INCREF(builtin); } else { - /* If we share the globals, we share the builtins. + /* If we share the globals, we share the builtin. Save a lookup and a call. */ - builtins = back->f_builtins; - assert(builtins != NULL && PyDict_Check(builtins)); - Py_INCREF(builtins); + builtin = back->f_builtin; + assert(builtin != NULL && PyDict_Check(builtin)); + Py_INCREF(builtin); } if (code->co_zombieframe != NULL) { f = code->co_zombieframe; @@ -607,7 +607,7 @@ f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, extras); if (f == NULL) { - Py_DECREF(builtins); + Py_DECREF(builtin); return NULL; } } @@ -619,7 +619,7 @@ if (Py_Size(f) < extras) { f = PyObject_GC_Resize(PyFrameObject, f, extras); if (f == NULL) { - Py_DECREF(builtins); + Py_DECREF(builtin); return NULL; } } @@ -636,7 +636,7 @@ f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL; } f->f_stacktop = f->f_valuestack; - f->f_builtins = builtins; + f->f_builtin = builtin; Py_XINCREF(back); f->f_back = back; Py_INCREF(code); Index: Tools/i18n/pygettext.py =================================================================== --- Tools/i18n/pygettext.py (revision 57016) +++ Tools/i18n/pygettext.py (working copy) @@ -237,7 +237,7 @@ def safe_eval(s): # unwrap quotes, safely - return eval(s, {'__builtins__':{}}, {}) + return eval(s, {'__builtin__':{}}, {}) def normalize(s): Index: Lib/rlcompleter.py =================================================================== --- Lib/rlcompleter.py (revision 57016) +++ Lib/rlcompleter.py (working copy) @@ -100,7 +100,7 @@ __builtin__.__dict__, self.namespace]: for word in list: - if word[:n] == text and word != "__builtins__": + if word[:n] == text and word != "__builtin__": matches.append(word) return matches @@ -129,7 +129,7 @@ matches = [] n = len(attr) for word in words: - if word[:n] == attr and word != "__builtins__": + if word[:n] == attr and word != "__builtin__": matches.append("%s.%s" % (expr, word)) return matches Index: Lib/idlelib/AutoComplete.py =================================================================== --- Lib/idlelib/AutoComplete.py (revision 57016) +++ Lib/idlelib/AutoComplete.py (working copy) @@ -183,7 +183,7 @@ if mode == COMPLETE_ATTRIBUTES: if what == "": namespace = __main__.__dict__.copy() - namespace.update(__main__.__builtins__.__dict__) + namespace.update(__main__.__builtin__.__dict__) bigl = eval("dir()", namespace) bigl.sort() if "__all__" in bigl: Index: Lib/copy.py =================================================================== --- Lib/copy.py (revision 57016) +++ Lib/copy.py (working copy) @@ -108,7 +108,7 @@ if t is not None: d[t] = _copy_immutable for name in ("complex", "unicode"): - t = globals()['__builtins__'].get(name) + t = globals()['__builtin__'].get(name) if t is not None: d[t] = _copy_immutable Index: Lib/logging/__init__.py =================================================================== --- Lib/logging/__init__.py (revision 57016) +++ Lib/logging/__init__.py (working copy) @@ -48,7 +48,7 @@ # Miscellaneous module data #--------------------------------------------------------------------------- -_unicode = 'unicode' in dir(__builtins__) +_unicode = 'unicode' in dir(__builtin__) # # _srcfile is used when walking the stack to check when we've got the first Index: Lib/pdb.py =================================================================== --- Lib/pdb.py (revision 57016) +++ Lib/pdb.py (working copy) @@ -1153,7 +1153,7 @@ __main__.__dict__.clear() __main__.__dict__.update({"__name__" : "__main__", "__file__" : filename, - "__builtins__": __builtins__, + "__builtin__": __builtin__, }) # When bdb sets tracing, a number of call and line events happens Index: Lib/pydoc.py =================================================================== --- Lib/pydoc.py (revision 57016) +++ Lib/pydoc.py (working copy) @@ -159,7 +159,7 @@ def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. - if name in ('__builtins__', '__doc__', '__file__', '__path__', + if name in ('__builtin__', '__doc__', '__file__', '__path__', '__module__', '__name__', '__slots__'): return 0 # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 Index: Lib/cProfile.py =================================================================== --- Lib/cProfile.py (revision 57016) +++ Lib/cProfile.py (working copy) @@ -64,7 +64,7 @@ # ____________________________________________________________ class Profile(_lsprof.Profiler): - """Profile(custom_timer=None, time_unit=None, subcalls=True, builtins=True) + """Profile(custom_timer=None, time_unit=None, subcalls=True, builtin=True) Builds a profiler object using the specified timer function. The default timer is a fast built-in one based on real time. Index: Lib/doctest.py =================================================================== --- Lib/doctest.py (revision 57016) +++ Lib/doctest.py (working copy) @@ -1646,7 +1646,7 @@ If a failure or error occurs, the globals are left intact: - >>> del test.globs['__builtins__'] + >>> del test.globs['__builtin__'] >>> test.globs {'x': 1} @@ -1660,7 +1660,7 @@ ... doctest.UnexpectedException: - >>> del test.globs['__builtins__'] + >>> del test.globs['__builtin__'] >>> test.globs {'x': 2} Index: Lib/test/test_optparse.py =================================================================== --- Lib/test/test_optparse.py (revision 57016) +++ Lib/test/test_optparse.py (working copy) @@ -779,14 +779,14 @@ (options, args) = self.assertParseOK(["-q"], {'verbose': 0}, []) - if hasattr(__builtins__, 'False'): + if hasattr(__builtin__, 'False'): self.failUnless(options.verbose is False) def test_bool_true(self): (options, args) = self.assertParseOK(["-v"], {'verbose': 1}, []) - if hasattr(__builtins__, 'True'): + if hasattr(__builtin__, 'True'): self.failUnless(options.verbose is True) def test_bool_flicker_on_and_off(self): Index: Lib/test/test_pkgimport.py =================================================================== --- Lib/test/test_pkgimport.py (revision 57016) +++ Lib/test/test_pkgimport.py (working copy) @@ -55,9 +55,9 @@ self.assert_(self.module_name not in sys.modules and not hasattr(sys.modules[self.package_name], 'foo')) - # ...make up a variable name that isn't bound in __builtins__ + # ...make up a variable name that isn't bound in __builtin__ var = 'a' - while var in dir(__builtins__): + while var in dir(__builtin__): var += random.choose(string.ascii_letters) # ...make a module that just contains that Index: Lib/test/test_descrtut.py =================================================================== --- Lib/test/test_descrtut.py (revision 57016) +++ Lib/test/test_descrtut.py (working copy) @@ -71,7 +71,7 @@ >>> exec("x = 3; print(x)", a) 3 >>> print(sorted(a.keys(), key=lambda x: (str(type(x)), x))) - [1, 2, '__builtins__', 'print', 'x'] + [1, 2, '__builtin__', 'print', 'x'] >>> print(a['x']) 3 >>> Index: Lib/test/test_new.py =================================================================== --- Lib/test/test_new.py (revision 57016) +++ Lib/test/test_new.py (working copy) @@ -63,9 +63,9 @@ codestr = "\n".join(l.strip() for l in codestr.splitlines()) ccode = compile(codestr, '', 'exec') - # Jython doesn't have a __builtins__, so use a portable alternative + # Jython doesn't have a __builtin__, so use a portable alternative import __builtin__ - g = {'c': 0, '__builtins__': __builtin__} + g = {'c': 0, '__builtin__': __builtin__} # this test could be more robust func = new.function(ccode, g) Index: Lib/test/test_pkg.py =================================================================== --- Lib/test/test_pkg.py (revision 57016) +++ Lib/test/test_pkg.py (working copy) @@ -45,7 +45,7 @@ def fixdir(lst): try: - lst.remove('__builtins__') + lst.remove('__builtin__') except ValueError: pass return lst Index: Lib/test/test_compile.py =================================================================== --- Lib/test/test_compile.py (revision 57016) +++ Lib/test/test_compile.py (working copy) @@ -236,7 +236,7 @@ stmts = [ 'None = 0', 'None += 0', - '__builtins__.None = 0', + '__builtin__.None = 0', 'def None(): pass', 'class None: pass', '(a, None) = 0, 0', Index: Lib/test/test___all__.py =================================================================== --- Lib/test/test___all__.py (revision 57016) +++ Lib/test/test___all__.py (working copy) @@ -17,8 +17,8 @@ "%s has no __all__ attribute" % modname) names = {} exec("from %s import *" % modname, names) - if "__builtins__" in names: - del names["__builtins__"] + if "__builtin__" in names: + del names["__builtin__"] keys = set(names) all = set(sys.modules[modname].__all__) self.assertEqual(keys, all) Index: Lib/test/test_builtin.py =================================================================== --- Lib/test/test_builtin.py (revision 57016) +++ Lib/test/test_builtin.py (working copy) @@ -398,13 +398,13 @@ def test_exec(self): g = {} exec('z = 1', g) - if '__builtins__' in g: - del g['__builtins__'] + if '__builtin__' in g: + del g['__builtin__'] self.assertEqual(g, {'z': 1}) exec('z = 1+1', g) - if '__builtins__' in g: - del g['__builtins__'] + if '__builtin__' in g: + del g['__builtin__'] self.assertEqual(g, {'z': 2}) g = {} l = {} @@ -412,10 +412,10 @@ import warnings warnings.filterwarnings("ignore", "global statement", module="") exec('global a; a = 1; b = 2', g, l) - if '__builtins__' in g: - del g['__builtins__'] - if '__builtins__' in l: - del l['__builtins__'] + if '__builtin__' in g: + del g['__builtin__'] + if '__builtin__' in l: + del l['__builtin__'] self.assertEqual((g, l), ({'a': 1}, {'b': 2})) def test_filter(self): Index: Lib/test/test_funcattrs.py =================================================================== --- Lib/test/test_funcattrs.py (revision 57016) +++ Lib/test/test_funcattrs.py (working copy) @@ -264,7 +264,7 @@ cantset(f, "__name__", 1) # test that you can access func.__name__ in restricted mode s = """def f(): pass\nf.__name__""" - exec(s, {'__builtins__':{}}) + exec(s, {'__builtin__':{}}) def test_func_code(): Index: Lib/cgitb.py =================================================================== --- Lib/cgitb.py (revision 57016) +++ Lib/cgitb.py (working copy) @@ -62,8 +62,8 @@ return 'local', locals[name] if name in frame.f_globals: return 'global', frame.f_globals[name] - if '__builtins__' in frame.f_globals: - builtins = frame.f_globals['__builtins__'] + if '__builtin__' in frame.f_globals: + builtins = frame.f_globals['__builtin__'] if type(builtins) is type({}): if name in builtins: return 'builtin', builtins[name] Index: Modules/_lsprof.c =================================================================== --- Modules/_lsprof.c (revision 57016) +++ Modules/_lsprof.c (working copy) @@ -86,7 +86,7 @@ /* represents a function or user defined block */ typedef struct _ProfilerEntry { rotating_node_t header; - PyObject *userObj; /* PyCodeObject, or a descriptive str for builtins */ + PyObject *userObj; /* PyCodeObject, or a descriptive str for builtin */ PY_LONG_LONG tt; /* total time in this entry */ PY_LONG_LONG it; /* inline time in this entry (not in subcalls) */ long callcount; /* how many times this was called */ @@ -655,7 +655,7 @@ else if (nvalue > 0) { #ifndef PyTrace_C_CALL PyErr_SetString(PyExc_ValueError, - "builtins=True requires Python >= 2.4"); + "builtin=True requires Python >= 2.4"); return -1; #else pObj->flags |= POF_BUILTINS; @@ -665,12 +665,12 @@ } PyDoc_STRVAR(enable_doc, "\ -enable(subcalls=True, builtins=True)\n\ +enable(subcalls=True, builtin=True)\n\ \n\ Start collecting profiling information.\n\ If 'subcalls' is True, also records for each function\n\ statistics separated according to its current caller.\n\ -If 'builtins' is True, records the time spent in\n\ +If 'builtin' is True, records the time spent in\n\ built-in functions separately from their caller.\n\ "); @@ -678,12 +678,12 @@ profiler_enable(ProfilerObject *self, PyObject *args, PyObject *kwds) { int subcalls = -1; - int builtins = -1; - static char *kwlist[] = {"subcalls", "builtins", 0}; + int builtin = -1; + static char *kwlist[] = {"subcalls", "builtin", 0}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ii:enable", - kwlist, &subcalls, &builtins)) + kwlist, &subcalls, &builtin)) return NULL; - if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtins) < 0) + if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtin) < 0) return NULL; PyEval_SetProfile(profiler_callback, (PyObject*)self); self->flags |= POF_ENABLED; @@ -758,19 +758,19 @@ double timeunit = 0.0; int subcalls = 1; #ifdef PyTrace_C_CALL - int builtins = 1; + int builtin = 1; #else - int builtins = 0; + int builtin = 0; #endif static char *kwlist[] = {"timer", "timeunit", - "subcalls", "builtins", 0}; + "subcalls", "builtin", 0}; if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odii:Profiler", kwlist, &timer, &timeunit, - &subcalls, &builtins)) + &subcalls, &builtin)) return -1; - if (setSubcalls(pObj, subcalls) < 0 || setBuiltins(pObj, builtins) < 0) + if (setSubcalls(pObj, subcalls) < 0 || setBuiltins(pObj, builtin) < 0) return -1; o = pObj->externalTimer; pObj->externalTimer = timer; @@ -793,7 +793,7 @@ }; PyDoc_STRVAR(profiler_doc, "\ -Profiler(custom_timer=None, time_unit=None, subcalls=True, builtins=True)\n\ +Profiler(custom_timer=None, time_unit=None, subcalls=True, builtin=True)\n\ \n\ Builds a profiler object using the specified timer function.\n\ The default timer is a fast built-in one based on real time.\n\ Index: Modules/_bsddb.c =================================================================== --- Modules/_bsddb.c (revision 57016) +++ Modules/_bsddb.c (working copy) @@ -6011,7 +6011,7 @@ PyDict_SetItemString(d, "KeyError", PyExc_KeyError); { PyObject *builtin_mod = PyImport_ImportModule("__builtin__"); - PyDict_SetItemString(d, "__builtins__", builtin_mod); + PyDict_SetItemString(d, "__builtin__", builtin_mod); } PyRun_String("class DBNotFoundError(DBError, KeyError): pass\n" "class DBKeyEmptyError(DBError, KeyError): pass", Index: Modules/_elementtree.c =================================================================== --- Modules/_elementtree.c (revision 57016) +++ Modules/_elementtree.c (working copy) @@ -2565,7 +2565,7 @@ if (!g) return; - PyDict_SetItemString(g, "__builtins__", PyEval_GetBuiltins()); + PyDict_SetItemString(g, "__builtin__", PyEval_GetBuiltins()); bootstrap = ( Index: Modules/itertoolsmodule.c =================================================================== --- Modules/itertoolsmodule.c (revision 57016) +++ Modules/itertoolsmodule.c (working copy) @@ -1490,7 +1490,7 @@ } /* -imap() is an iterator version of __builtins__.map() except that it does +imap() is an iterator version of __builtin__.map() except that it does not have the None fill-in feature. That was intentionally left out for the following reasons: @@ -1508,7 +1508,7 @@ do something useful when a parameter suddenly switches type and becomes None. - 4) If a need does arise, it can be met by __builtins__.map() or by + 4) If a need does arise, it can be met by __builtin__.map() or by writing: chain(iterable, repeat(None)). 5) Similar toolsets in Haskell and SML do not have automatic None fill-in.