summaryrefslogtreecommitdiff
path: root/Python/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 029f2b996d..944ae35a0c 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -569,7 +569,13 @@ r_object(RFILE *p)
return v;
case TYPE_CODE:
- {
+ if (PyEval_GetRestricted()) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "cannot unmarshal code objects in "
+ "restricted execution mode");
+ return NULL;
+ }
+ else {
int argcount = r_short(p);
int nlocals = r_short(p);
int stacksize = r_short(p);