Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 27181ac

Browse files
author
Victor Stinner
committed
sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not
called yet: detect bootstrap (startup) issues earlier.
1 parent 7899acf commit 27181ac

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Core and Builtins
4949
Library
5050
-------
5151

52+
- sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not
53+
called yet: detect bootstrap (startup) issues earlier.
54+
5255
- Issue #11618: Fix the timeout logic in threading.Lock.acquire() under Windows.
5356

5457
- Issue #11256: Fix inspect.getcallargs on functions that take only keyword

Python/sysmodule.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ sys_getfilesystemencoding(PyObject *self)
259259
{
260260
if (Py_FileSystemDefaultEncoding)
261261
return PyUnicode_FromString(Py_FileSystemDefaultEncoding);
262-
Py_INCREF(Py_None);
263-
return Py_None;
262+
PyErr_SetString(PyExc_RuntimeError,
263+
"filesystem encoding is not initialized");
264+
return NULL;
264265
}
265266

266267
PyDoc_STRVAR(getfilesystemencoding_doc,

0 commit comments

Comments
 (0)