diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-03-31 11:39:03 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-03-31 11:39:03 (GMT) |
| commit | 27181ac778fdb8432d79f280922eac0f70af5194 (patch) | |
| tree | 1b0eace235d0f562c000fefd848f1bd125c4dc9a | |
| parent | 7899acfc23c6262cea8f69bda36cf256cdfc3501 (diff) | |
| download | cpython-27181ac778fdb8432d79f280922eac0f70af5194.zip cpython-27181ac778fdb8432d79f280922eac0f70af5194.tar.gz cpython-27181ac778fdb8432d79f280922eac0f70af5194.tar.bz2 | |
sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not
called yet: detect bootstrap (startup) issues earlier.
| -rw-r--r-- | Misc/NEWS | 3 | ||||
| -rw-r--r-- | Python/sysmodule.c | 5 |
2 files changed, 6 insertions, 2 deletions
@@ -49,6 +49,9 @@ Core and Builtins Library ------- +- sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not + called yet: detect bootstrap (startup) issues earlier. + - Issue #11618: Fix the timeout logic in threading.Lock.acquire() under Windows. - Issue #11256: Fix inspect.getcallargs on functions that take only keyword diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 8d44135..5664646 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -259,8 +259,9 @@ sys_getfilesystemencoding(PyObject *self) { 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, |
