[Python-checkins] cpython (merge 3.2 -> default): Merge 3.2: sys.getfilesystemencoding() raises a RuntimeError if

victor.stinner python-checkins at python.org
Thu Mar 31 13:56:57 CEST 2011


http://hg.python.org/cpython/rev/92212a7b85a3
changeset:   69078:92212a7b85a3
parent:      69076:aa2ac1581d23
parent:      69077:a00b9a5688da
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Mar 31 13:40:14 2011 +0200
summary:
  Merge 3.2: sys.getfilesystemencoding() raises a RuntimeError if
initfsencoding() was not called yet: detect bootstrap (startup) issues earlier.

files:
  Misc/NEWS          |  3 +++
  Python/sysmodule.c |  5 +++--
  2 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -87,6 +87,9 @@
 Library
 -------
 
+- sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not
+  called yet: detect bootstrap (startup) issues earlier.
+
 - Issue #11393: Add the new faulthandler module.
 
 - Issue #11618: Fix the timeout logic in threading.Lock.acquire() under Windows.
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -259,8 +259,9 @@
 {
     if (Py_FileSystemDefaultEncoding)
         return PyUnicode_FromString(Py_FileSystemDefaultEncoding);
-    Py_INCREF(Py_None);
-    return Py_None;
+    PyErr_SetString(PyExc_RuntimeError,
+                    "filesystem encoding is not initialized");
+    return NULL;
 }
 
 PyDoc_STRVAR(getfilesystemencoding_doc,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list