mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
https://bugs.python.org/issue46765
This commit is contained in:
parent
cff4d5c5d2
commit
1f455361ec
22 changed files with 192 additions and 526 deletions
|
|
@ -157,13 +157,7 @@ static PyMemberDef method_memberlist[] = {
|
|||
static PyObject *
|
||||
method_get_doc(PyMethodObject *im, void *context)
|
||||
{
|
||||
static PyObject *docstr;
|
||||
if (docstr == NULL) {
|
||||
docstr= PyUnicode_InternFromString("__doc__");
|
||||
if (docstr == NULL)
|
||||
return NULL;
|
||||
}
|
||||
return PyObject_GetAttr(im->im_func, docstr);
|
||||
return PyObject_GetAttr(im->im_func, &_Py_ID(__doc__));
|
||||
}
|
||||
|
||||
static PyGetSetDef method_getset[] = {
|
||||
|
|
@ -405,13 +399,8 @@ static PyMemberDef instancemethod_memberlist[] = {
|
|||
static PyObject *
|
||||
instancemethod_get_doc(PyObject *self, void *context)
|
||||
{
|
||||
static PyObject *docstr;
|
||||
if (docstr == NULL) {
|
||||
docstr = PyUnicode_InternFromString("__doc__");
|
||||
if (docstr == NULL)
|
||||
return NULL;
|
||||
}
|
||||
return PyObject_GetAttr(PyInstanceMethod_GET_FUNCTION(self), docstr);
|
||||
return PyObject_GetAttr(PyInstanceMethod_GET_FUNCTION(self),
|
||||
&_Py_ID(__doc__));
|
||||
}
|
||||
|
||||
static PyGetSetDef instancemethod_getset[] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue