From 1d1075517c6800f0d7a311fac977dc86edbdc25f Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 16 Apr 2019 21:12:34 +0900 Subject: [PATCH 1/6] bpo-36641: Add "const" to PyDoc_VAR(name) macro It reduces "data" segment in python about 200KB. --- Include/pymacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/pymacro.h b/Include/pymacro.h index 3f6ddbe9977acec..546f9c6e7020254 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -67,7 +67,7 @@ /* Define macros for inline documentation. */ -#define PyDoc_VAR(name) static char name[] +#define PyDoc_VAR(name) static const char name[] #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #ifdef WITH_DOC_STRINGS #define PyDoc_STR(str) str From cc0e867b6955455fdaed358e90c2618c0dfdb275 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 16 Apr 2019 21:18:22 +0900 Subject: [PATCH 2/6] add NEWS entry --- .../Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst new file mode 100644 index 000000000000000..0af461d5944a563 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst @@ -0,0 +1,2 @@ +:c:macro:`PyDoc_VAR(name)` and :c:macro:`PyDoc_STRVAR(name,str)`` now create +``static const name[]`` instead of ``static name[]``. Patch by Inada Naoki. From 96282b095da7a1bdeee9db91d5bae0dd60014941 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 16 Apr 2019 21:55:59 +0900 Subject: [PATCH 3/6] move NEWS file to 'C API' section --- .../2019-04-16-21-18-19.bpo-36641.pz-DIR.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/NEWS.d/next/{Core and Builtins => C API}/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst (100%) diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst b/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst similarity index 100% rename from Misc/NEWS.d/next/Core and Builtins/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst rename to Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst From a56af9fb94ff3408b735463f6004c3e432374d03 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 16 Apr 2019 22:00:44 +0900 Subject: [PATCH 4/6] Update Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst Co-Authored-By: methane --- Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst b/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst index 0af461d5944a563..6b5238fbd32d649 100644 --- a/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst +++ b/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst @@ -1,2 +1,2 @@ -:c:macro:`PyDoc_VAR(name)` and :c:macro:`PyDoc_STRVAR(name,str)`` now create +:c:macro:`PyDoc_VAR(name)` and :c:macro:`PyDoc_STRVAR(name,str)` now create ``static const name[]`` instead of ``static name[]``. Patch by Inada Naoki. From f7b8037111692151b974c9e4c18a5a0234d875e7 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 16 Apr 2019 22:04:56 +0900 Subject: [PATCH 5/6] supporess warning in _ssl module --- Modules/_ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index f8ae916735f4409..e75e3466dd3f2a6 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -557,7 +557,7 @@ SSLError_str(PyOSErrorObject *self) static PyType_Slot sslerror_type_slots[] = { {Py_tp_base, NULL}, /* Filled out in module init as it's not a constant */ - {Py_tp_doc, SSLError_doc}, + {Py_tp_doc, (void*)SSLError_doc}, {Py_tp_str, SSLError_str}, {0, 0}, }; From 4ed70787b50cea382605cd06762df31f1aea293f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 16 Apr 2019 22:35:22 +0900 Subject: [PATCH 6/6] Update Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst Co-Authored-By: methane --- Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst b/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst index 6b5238fbd32d649..f92af63029be0f6 100644 --- a/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst +++ b/Misc/NEWS.d/next/C API/2019-04-16-21-18-19.bpo-36641.pz-DIR.rst @@ -1,2 +1,2 @@ :c:macro:`PyDoc_VAR(name)` and :c:macro:`PyDoc_STRVAR(name,str)` now create -``static const name[]`` instead of ``static name[]``. Patch by Inada Naoki. +``static const char name[]`` instead of ``static char name[]``. Patch by Inada Naoki.