diff Python/bltinmodule.c @ 21398:de125792bfaa legacy-trunk

Fix for SF bug [ #492403 ] exec() segfaults on closure's func_code Based on the patch from Danny Yoo. The fix is in exec_statement() in ceval.c. There are also changes to introduce use of PyCode_GetNumFree() in several places.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Thu, 13 Dec 2001 19:51:56 +0000
parents 379fc66f4c96
children c64fc56f6072
line wrap: on
line diff
--- a/Python/bltinmodule.c	Thu Dec 13 19:47:51 2001 +0000
+++ b/Python/bltinmodule.c	Thu Dec 13 19:51:56 2001 +0000
@@ -497,7 +497,7 @@
 	}
 
 	if (PyCode_Check(cmd)) {
-		if (PyTuple_GET_SIZE(((PyCodeObject *)cmd)->co_freevars) > 0) {
+		if (PyCode_GetNumFree((PyCodeObject *)cmd) > 0) {
 			PyErr_SetString(PyExc_TypeError,
 		"code object passed to eval() may not contain free variables");
 			return NULL;