summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-04-18 22:57:45 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-04-18 22:57:45 (GMT)
commitb0b224233e481d979430a54d257d871424ff19fb (patch)
tree86be7f1a45404ec56003f36f5f76dd82c85c6ca8 /Objects/frameobject.c
parent05fac022eca4604275e16c62136ca02aaea879e1 (diff)
downloadcpython-b0b224233e481d979430a54d257d871424ff19fb.zip
cpython-b0b224233e481d979430a54d257d871424ff19fb.tar.gz
cpython-b0b224233e481d979430a54d257d871424ff19fb.tar.bz2
Issue #14385: Support other types than dict for __builtins__
It is now possible to use a custom type for the __builtins__ namespace, instead of a dict. It can be used for sandboxing for example. Raise also a NameError instead of ImportError if __build_class__ name if not found in __builtins__.
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index c8b8b1d..6208556 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -614,10 +614,8 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
if (builtins) {
if (PyModule_Check(builtins)) {
builtins = PyModule_GetDict(builtins);
- assert(!builtins || PyDict_Check(builtins));
+ assert(builtins != NULL);
}
- else if (!PyDict_Check(builtins))
- builtins = NULL;
}
if (builtins == NULL) {
/* No builtins! Make up a minimal one
@@ -636,7 +634,7 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
/* If we share the globals, we share the builtins.
Save a lookup and a call. */
builtins = back->f_builtins;
- assert(builtins != NULL && PyDict_Check(builtins));
+ assert(builtins != NULL);
Py_INCREF(builtins);
}
if (code->co_zombieframe != NULL) {