[pypy-issue] Issue #2669: Py_FileSystemDefaultEncoding always set to NULL for C extension modules (pypy/pypy)

Ben Hoyt issues-reply at bitbucket.org
Wed Sep 27 21:11:42 EDT 2017


New issue 2669: Py_FileSystemDefaultEncoding always set to NULL for C extension modules
https://bitbucket.org/pypy/pypy/issues/2669/py_filesystemdefaultencoding-always-set-to

Ben Hoyt:

Py_FileSystemDefaultEncoding is a CPython C extension value used for decoding bytes filenames to unicode in C extensions. For example, my scandir library uses this: https://github.com/benhoyt/scandir/blob/7dc415a81f36599cfce5c556bf28ba2b4d4607b2/_scandir.c#L1484-L1487

However, in PyPy in fileobject.h it's #define'd to be NULL, making it not very useful. I'm going to fix in scandir by basically doing:

Py_FileSystemDefaultEncoding ? Py_FileSystemDefaultEncoding : "UTF-8"

wherever I currently use it.

Note that sys.getfilesystemencoding() does return "UTF-8" correctly.

Would "UTF-8" (on Linux, or "mbcs" on Windows) be a better value for Py_FileSystemDefaultEncoding than NULL?




More information about the pypy-issue mailing list