Merge 3.2: sys.getfilesystemencoding() raises a RuntimeError if
initfsencoding() was not called yet: detect bootstrap (startup) issues earlier.
diff --git a/Misc/NEWS b/Misc/NEWS
index fff54b8..e9f0a59 100644
--- 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
index 33255ad..fdf361f 100644
--- 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,