[Python-checkins] r72244 - python/branches/pep-0383/Modules/posixmodule.c

martin.v.loewis python-checkins at python.org
Sun May 3 22:21:07 CEST 2009


Author: martin.v.loewis
Date: Sun May  3 22:21:06 2009
New Revision: 72244

Log:
Have listdir raise an exception on undecodable ASCII bytes.


Modified:
   python/branches/pep-0383/Modules/posixmodule.c

Modified: python/branches/pep-0383/Modules/posixmodule.c
==============================================================================
--- python/branches/pep-0383/Modules/posixmodule.c	(original)
+++ python/branches/pep-0383/Modules/posixmodule.c	Sun May  3 22:21:06 2009
@@ -2511,17 +2511,15 @@
 			w = PyUnicode_FromEncodedObject(v,
 					Py_FileSystemDefaultEncoding,
 					"utf8b");
-			if (w != NULL) {
-				Py_DECREF(v);
+			Py_DECREF(v);
+			if (w != NULL)
 				v = w;
-			}
 			else {
-				/* Ignore undecodable filenames, as discussed
-				 * in issue 3187. To include these,
-				 * use getcwdb(). */
-				PyErr_Clear();
-				Py_DECREF(v);
-				continue;
+				/* Encoding failed to decode ASCII bytes.
+				   Raise exception. */
+				Py_DECREF(d);
+				d = NULL;
+				break;
 			}
 		}
 		if (PyList_Append(d, v) != 0) {


More information about the Python-checkins mailing list