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

It reduces "data" segment in python about 200KB.
This commit is contained in:
Inada Naoki 2019-04-17 08:39:46 +09:00 committed by GitHub
parent 31e8d69bfe
commit 926b0cb5f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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.

View File

@ -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},
};