From 31708f43bfaf0e03accf8655c3a328bfbcf8af75 Mon Sep 17 00:00:00 2001 From: Hasan Date: Fri, 11 Feb 2022 20:53:31 +0400 Subject: [PATCH 1/5] bpo-39355: making Python.h compatible with C++20 compilers Renamed module to mod in header files --- Include/cpython/import.h | 4 ++-- Include/cpython/warnings.h | 4 ++-- Include/modsupport.h | 4 ++-- Include/warnings.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Include/cpython/import.h b/Include/cpython/import.h index da9fb770a92453..88c6aa9910d3b0 100644 --- a/Include/cpython/import.h +++ b/Include/cpython/import.h @@ -7,8 +7,8 @@ PyMODINIT_FUNC PyInit__imp(void); PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); -PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); -PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); +PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *mod); +PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject *mod); PyAPI_FUNC(void) _PyImport_AcquireLock(void); PyAPI_FUNC(int) _PyImport_ReleaseLock(void); diff --git a/Include/cpython/warnings.h b/Include/cpython/warnings.h index 2ef8e3ce9435f4..2daa4f97afcffa 100644 --- a/Include/cpython/warnings.h +++ b/Include/cpython/warnings.h @@ -7,13 +7,13 @@ PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *message, PyObject *filename, int lineno, - PyObject *module, + PyObject *mod, PyObject *registry); PyAPI_FUNC(int) PyErr_WarnExplicitFormat( PyObject *category, const char *filename, int lineno, - const char *module, PyObject *registry, + const char *mod, PyObject *registry, const char *format, ...); // DEPRECATED: Use PyErr_WarnEx() instead. diff --git a/Include/modsupport.h b/Include/modsupport.h index baf47f0038d08d..27a7c9559803cf 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -158,7 +158,7 @@ PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *); #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000 /* New in 3.9 */ -PyAPI_FUNC(int) PyModule_AddType(PyObject *module, PyTypeObject *type); +PyAPI_FUNC(int) PyModule_AddType(PyObject *mod, PyTypeObject *type); #endif /* Py_LIMITED_API */ #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c) @@ -167,7 +167,7 @@ PyAPI_FUNC(int) PyModule_AddType(PyObject *module, PyTypeObject *type); /* New in 3.5 */ PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *); PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *); -PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def); +PyAPI_FUNC(int) PyModule_ExecDef(PyObject *mod, PyModuleDef *def); #endif #define Py_CLEANUP_SUPPORTED 0x20000 diff --git a/Include/warnings.h b/Include/warnings.h index 18ac1543a3ca9e..c18098ea6f9a81 100644 --- a/Include/warnings.h +++ b/Include/warnings.h @@ -29,7 +29,7 @@ PyAPI_FUNC(int) PyErr_WarnExplicit( const char *message, /* UTF-8 encoded string */ const char *filename, /* decoded from the filesystem encoding */ int lineno, - const char *module, /* UTF-8 encoded string */ + const char *mod, /* UTF-8 encoded string */ PyObject *registry); #ifndef Py_LIMITED_API From 75e9690bf6d2b8c432628608c7c7357f03fb5573 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:51:11 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst b/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst new file mode 100644 index 00000000000000..0d9df1c498b07f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst @@ -0,0 +1 @@ +Make Python.h compatible with C++20 compilers From cb7c2648bcbc0eec680b15b8d9d7d206865bc660 Mon Sep 17 00:00:00 2001 From: Hasan Date: Fri, 11 Feb 2022 22:56:56 +0400 Subject: [PATCH 3/5] Update 2022-02-11-18-51-11.bpo-39355.rcUPdT.rst --- .../Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst b/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst index 0d9df1c498b07f..50bef8217622a9 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2022-02-11-18-51-11.bpo-39355.rcUPdT.rst @@ -1 +1 @@ -Make Python.h compatible with C++20 compilers +Make Python.h compatible with C++20 compilers. From 2f4c9f02a2a8abaa089d4c9dffb0a6591839d3dc Mon Sep 17 00:00:00 2001 From: Hasan Date: Fri, 11 Feb 2022 23:18:45 +0400 Subject: [PATCH 4/5] bpo-39355: added a note in What's New - Make Python.h compatible with C++20 compilers --- Doc/whatsnew/3.11.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 95fce1e8e10822..a7ea0d11a7c5d1 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -650,6 +650,8 @@ Build Changes be removed at some point in the future. (Contributed by Mark Dickinson in :issue:`45569`.) +* Python.h is now compatible with C++20 compilers. (Contributed by by Hasan + Aliyev in :issue:`39355`.) C API Changes ============= From f7d973b621e6c1bb39580a4f0add1a0f15863cc7 Mon Sep 17 00:00:00 2001 From: Hasan Date: Mon, 28 Mar 2022 22:14:50 +0400 Subject: [PATCH 5/5] Update 3.11.rst --- Doc/whatsnew/3.11.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 7441aa15a8bd9b..ffb48f148ab0ee 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -786,7 +786,7 @@ Build Changes * The :mod:`tkinter` package now requires Tcl/Tk version 8.5.12 or newer. (Contributed by Serhiy Storchaka in :issue:`46996`.) - + * Python.h is now compatible with C++20 compilers. (Contributed by by Hasan Aliyev in :issue:`39355`.)