Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 44098:0889daf6d0d9
#1535: rename __builtin__ module to builtins.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sun, 02 Dec 2007 09:40:06 +0000 |
| parents | 110ff614ec28 |
| children | f324631462a2 |
comparison
equal
deleted
inserted
replaced
| 44090:6d7fd95ef14a | 44098:0889daf6d0d9 |
|---|---|
| 70 sys_displayhook(PyObject *self, PyObject *o) | 70 sys_displayhook(PyObject *self, PyObject *o) |
| 71 { | 71 { |
| 72 PyObject *outf; | 72 PyObject *outf; |
| 73 PyInterpreterState *interp = PyThreadState_GET()->interp; | 73 PyInterpreterState *interp = PyThreadState_GET()->interp; |
| 74 PyObject *modules = interp->modules; | 74 PyObject *modules = interp->modules; |
| 75 PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); | 75 PyObject *builtins = PyDict_GetItemString(modules, "builtins"); |
| 76 | 76 |
| 77 if (builtins == NULL) { | 77 if (builtins == NULL) { |
| 78 PyErr_SetString(PyExc_RuntimeError, "lost __builtin__"); | 78 PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); |
| 79 return NULL; | 79 return NULL; |
| 80 } | 80 } |
| 81 | 81 |
| 82 /* Print value except if None */ | 82 /* Print value except if None */ |
| 83 /* After printing, also assign to '_' */ | 83 /* After printing, also assign to '_' */ |
| 104 } | 104 } |
| 105 | 105 |
| 106 PyDoc_STRVAR(displayhook_doc, | 106 PyDoc_STRVAR(displayhook_doc, |
| 107 "displayhook(object) -> None\n" | 107 "displayhook(object) -> None\n" |
| 108 "\n" | 108 "\n" |
| 109 "Print an object to sys.stdout and also save it in __builtin__.\n" | 109 "Print an object to sys.stdout and also save it in builtins.\n" |
| 110 ); | 110 ); |
| 111 | 111 |
| 112 static PyObject * | 112 static PyObject * |
| 113 sys_excepthook(PyObject* self, PyObject* args) | 113 sys_excepthook(PyObject* self, PyObject* args) |
| 114 { | 114 { |
| 894 __displayhook__ -- the original displayhook; don't touch!\n\ | 894 __displayhook__ -- the original displayhook; don't touch!\n\ |
| 895 __excepthook__ -- the original excepthook; don't touch!\n\ | 895 __excepthook__ -- the original excepthook; don't touch!\n\ |
| 896 \n\ | 896 \n\ |
| 897 Functions:\n\ | 897 Functions:\n\ |
| 898 \n\ | 898 \n\ |
| 899 displayhook() -- print an object to the screen, and save it in __builtin__._\n\ | 899 displayhook() -- print an object to the screen, and save it in builtins._\n\ |
| 900 excepthook() -- print an exception and its traceback to sys.stderr\n\ | 900 excepthook() -- print an exception and its traceback to sys.stderr\n\ |
| 901 exc_info() -- return thread-safe information about the current exception\n\ | 901 exc_info() -- return thread-safe information about the current exception\n\ |
| 902 exit() -- exit the interpreter by raising SystemExit\n\ | 902 exit() -- exit the interpreter by raising SystemExit\n\ |
| 903 getdlopenflags() -- returns flags to be used for dlopen() calls\n\ | 903 getdlopenflags() -- returns flags to be used for dlopen() calls\n\ |
| 904 getrefcount() -- return the reference count for an object (plus one :-)\n\ | 904 getrefcount() -- return the reference count for an object (plus one :-)\n\ |
