bpo-36641: Add "const" to PyDoc_VAR macro (GH-12854)
It reduces "data" segment in python about 200KB.
This commit is contained in:
parent
31e8d69bfe
commit
926b0cb5f6
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
: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)
|
||||||
|
|
||||||
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},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue