@@ -198,6 +198,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
198198# define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize
199199# define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode
200200# define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar
201+ # define PyUnicode_FSConverter PyUnicodeUCS2_FSConverter
201202# define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding
202203# define PyUnicode_GetMax PyUnicodeUCS2_GetMax
203204# define PyUnicode_GetSize PyUnicodeUCS2_GetSize
@@ -296,6 +297,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
296297# define PyUnicode_FromStringAndSize PyUnicodeUCS4_FromStringAndSize
297298# define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode
298299# define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar
300+ # define PyUnicode_FSConverter PyUnicodeUCS4_FSConverter
299301# define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding
300302# define PyUnicode_GetMax PyUnicodeUCS4_GetMax
301303# define PyUnicode_GetSize PyUnicodeUCS4_GetSize
@@ -693,25 +695,6 @@ PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
693695 PyObject * unicode ,
694696 const char * errors );
695697
696- /* Decode a null-terminated string using Py_FileSystemDefaultEncoding.
697-
698- If the encoding is supported by one of the built-in codecs (i.e., UTF-8,
699- UTF-16, UTF-32, Latin-1 or MBCS), otherwise fallback to UTF-8 and replace
700- invalid characters with '?'.
701-
702- The function is intended to be used for paths and file names only
703- during bootstrapping process where the codecs are not set up.
704- */
705-
706- PyAPI_FUNC (PyObject * ) PyUnicode_DecodeFSDefault (
707- const char * s /* encoded string */
708- );
709-
710- PyAPI_FUNC (PyObject * ) PyUnicode_DecodeFSDefaultAndSize (
711- const char * s , /* encoded string */
712- Py_ssize_t size /* size */
713- );
714-
715698/* Returns a pointer to the default encoding (normally, UTF-8) of the
716699 Unicode object unicode and the size of the encoded representation
717700 in bytes stored in *size.
@@ -1252,6 +1235,33 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
12521235 const char * errors /* error handling */
12531236 );
12541237
1238+ /* --- File system encoding ---------------------------------------------- */
1239+
1240+ /* ParseTuple converter which converts a Unicode object into the file
1241+ system encoding, using the PEP 383 error handler; bytes objects are
1242+ output as-is. */
1243+
1244+ PyAPI_FUNC (int ) PyUnicode_FSConverter (PyObject * , void * );
1245+
1246+ /* Decode a null-terminated string using Py_FileSystemDefaultEncoding.
1247+
1248+ If the encoding is supported by one of the built-in codecs (i.e., UTF-8,
1249+ UTF-16, UTF-32, Latin-1 or MBCS), otherwise fallback to UTF-8 and replace
1250+ invalid characters with '?'.
1251+
1252+ The function is intended to be used for paths and file names only
1253+ during bootstrapping process where the codecs are not set up.
1254+ */
1255+
1256+ PyAPI_FUNC (PyObject * ) PyUnicode_DecodeFSDefault (
1257+ const char * s /* encoded string */
1258+ );
1259+
1260+ PyAPI_FUNC (PyObject * ) PyUnicode_DecodeFSDefaultAndSize (
1261+ const char * s , /* encoded string */
1262+ Py_ssize_t size /* size */
1263+ );
1264+
12551265/* --- Methods & Slots ----------------------------------------------------
12561266
12571267 These are capable of handling Unicode objects and strings on input
0 commit comments