Commit 926b0cb5 authored by Inada Naoki's avatar Inada Naoki Committed by GitHub

bpo-36641: Add "const" to PyDoc_VAR macro (GH-12854)

It reduces "data" segment in python about 200KB.
parent 31e8d69b
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
/* Define macros for inline documentation. */ /* 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) #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
#ifdef WITH_DOC_STRINGS #ifdef WITH_DOC_STRINGS
#define PyDoc_STR(str) str #define PyDoc_STR(str) str
......
:c:macro:`PyDoc_VAR(name)` and :c:macro:`PyDoc_STRVAR(name,str)` now create
``static const char name[]`` instead of ``static char name[]``. Patch by Inada Naoki.
...@@ -557,7 +557,7 @@ SSLError_str(PyOSErrorObject *self) ...@@ -557,7 +557,7 @@ SSLError_str(PyOSErrorObject *self)
static PyType_Slot sslerror_type_slots[] = { static PyType_Slot sslerror_type_slots[] = {
{Py_tp_base, NULL}, /* Filled out in module init as it's not a constant */ {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}, {Py_tp_str, SSLError_str},
{0, 0}, {0, 0},
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment