From 44b6e215059186cebfa4b7b55a11a591cab028b3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 9 Oct 2020 22:51:02 +0300 Subject: [PATCH] bpo-41986: Add Py_FileSystemDefaultEncodeErrors and Py_UTF8Mode back to limited API --- Include/cpython/fileobject.h | 8 -------- Include/fileobject.h | 7 +++++++ .../next/C API/2020-10-09-22-50-46.bpo-41986.JUPE59.rst | 2 ++ 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 Misc/NEWS.d/next/C API/2020-10-09-22-50-46.bpo-41986.JUPE59.rst diff --git a/Include/cpython/fileobject.h b/Include/cpython/fileobject.h index 4f2408c7e87608..e2d89c522bdd13 100644 --- a/Include/cpython/fileobject.h +++ b/Include/cpython/fileobject.h @@ -4,14 +4,6 @@ PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); -#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 -PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; -#endif - -#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 -PyAPI_DATA(int) Py_UTF8Mode; -#endif - /* The std printer acts as a preliminary sys.stderr until the new io infrastructure is in place. */ PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); diff --git a/Include/fileobject.h b/Include/fileobject.h index 456887ef9d045d..6ec2994aa859b6 100644 --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -20,8 +20,15 @@ PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 +PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; +#endif PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 +PyAPI_DATA(int) Py_UTF8Mode; +#endif + /* A routine to check if a file descriptor can be select()-ed. */ #ifdef _MSC_VER /* On Windows, any socket fd can be select()-ed, no matter how high */ diff --git a/Misc/NEWS.d/next/C API/2020-10-09-22-50-46.bpo-41986.JUPE59.rst b/Misc/NEWS.d/next/C API/2020-10-09-22-50-46.bpo-41986.JUPE59.rst new file mode 100644 index 00000000000000..d456ba66bafd61 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-10-09-22-50-46.bpo-41986.JUPE59.rst @@ -0,0 +1,2 @@ +:c:data:`Py_FileSystemDefaultEncodeErrors` and :c:data:`Py_UTF8Mode` are +available again in limited API.