Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8019913

Browse files
author
Michael W. Hudson
committed
fix for part of bug #453523: disable unmarshalling of code objects in
restricted execution mode.
1 parent 3c0fc84 commit 8019913

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Python/marshal.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,13 @@ r_object(RFILE *p)
569569
return v;
570570

571571
case TYPE_CODE:
572-
{
572+
if (PyEval_GetRestricted()) {
573+
PyErr_SetString(PyExc_RuntimeError,
574+
"cannot unmarshal code objects in "
575+
"restricted execution mode");
576+
return NULL;
577+
}
578+
else {
573579
int argcount = r_short(p);
574580
int nlocals = r_short(p);
575581
int stacksize = r_short(p);

0 commit comments

Comments
 (0)