summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-07 21:22:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-07 21:22:39 (GMT)
commit07e9e380f93e334f8f11d3ff9f42bf7c68b27d3a (patch)
tree0f754b1f72795fb177d00cb8fb83c21e9c49715a /Objects
parente8453bc136bc3c7016bb88e419d8683e0e01fd72 (diff)
downloadcpython-07e9e380f93e334f8f11d3ff9f42bf7c68b27d3a.zip
cpython-07e9e380f93e334f8f11d3ff9f42bf7c68b27d3a.tar.gz
cpython-07e9e380f93e334f8f11d3ff9f42bf7c68b27d3a.tar.bz2
frameobject.c: Use an identifer instead of creating explicitly an interned
string for "__builtins__" literal string
Diffstat (limited to 'Objects')
-rw-r--r--Objects/frameobject.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 76e77b8..63f03a6 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -601,13 +601,13 @@ PyTypeObject PyFrame_Type = {
0, /* tp_dict */
};
-static PyObject *builtin_object;
+_Py_IDENTIFIER(__builtins__);
int _PyFrame_Init()
{
- builtin_object = PyUnicode_InternFromString("__builtins__");
- if (builtin_object == NULL)
- return 0;
+ /* Before, PyId___builtins__ was a string created explicitly in
+ this function. Now there is nothing to initialize anymore, but
+ the function is kept for backward compatibility. */
return 1;
}
@@ -628,7 +628,7 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
}
#endif
if (back == NULL || back->f_globals != globals) {
- builtins = PyDict_GetItem(globals, builtin_object);
+ builtins = _PyDict_GetItemId(globals, &PyId___builtins__);
if (builtins) {
if (PyModule_Check(builtins)) {
builtins = PyModule_GetDict(builtins);
@@ -994,8 +994,6 @@ void
PyFrame_Fini(void)
{
(void)PyFrame_ClearFreeList();
- Py_XDECREF(builtin_object);
- builtin_object = NULL;
}
/* Print summary info about the state of the optimized allocator */