[Python-checkins] r53901 - in python/trunk: Misc/NEWS Python/ceval.c

jeremy.hylton python-checkins at python.org
Sun Feb 25 16:57:47 CET 2007


Author: jeremy.hylton
Date: Sun Feb 25 16:57:45 2007
New Revision: 53901

Modified:
   python/trunk/Misc/NEWS
   python/trunk/Python/ceval.c
Log:
Fix crash in exec when unicode filename can't be decoded.

I can't think of an easy way to test this behavior.  It only occurs
when the file system default encoding and the interpreter default
encoding are different, such that you can open the file but not decode
its name.



Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Feb 25 16:57:45 2007
@@ -121,6 +121,7 @@
 
 - with and as are now keywords.
 
+- Bug #1664966: Fix crash in exec if Unicode filename can't be decoded.
 
 Library
 -------

Modified: python/trunk/Python/ceval.c
==============================================================================
--- python/trunk/Python/ceval.c	(original)
+++ python/trunk/Python/ceval.c	Sun Feb 25 16:57:45 2007
@@ -4202,6 +4202,8 @@
 	else if (PyFile_Check(prog)) {
 		FILE *fp = PyFile_AsFile(prog);
 		char *name = PyString_AsString(PyFile_Name(prog));
+                if (name == NULL)
+                        return -1;
 		PyCompilerFlags cf;
 		cf.cf_flags = 0;
 		if (PyEval_MergeCompilerFlags(&cf))


More information about the Python-checkins mailing list