summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-02-15 00:36:51 (GMT)
committerGitHub <noreply@github.com>2022-02-15 00:36:51 (GMT)
commit12360aa159c42c7798fd14225d271e6fd84db7eb (patch)
treead2b4f0d67c90a5a0be4ff532082fc3468d6d65b /Objects
parent278fdd3e3a2492665b2c2888fd2f428f7f59a3f5 (diff)
downloadcpython-12360aa159c42c7798fd14225d271e6fd84db7eb.zip
cpython-12360aa159c42c7798fd14225d271e6fd84db7eb.tar.gz
cpython-12360aa159c42c7798fd14225d271e6fd84db7eb.tar.bz2
bpo-46541: Discover the global strings. (gh-31346)
Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files. This is partly inspired by gh-31261. https://bugs.python.org/issue46541
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c1
-rw-r--r--Objects/weakrefobject.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 3f8f36a..8c49011 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4546,6 +4546,7 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(sorted_methods);
return NULL;
}
+ _Py_DECLARE_STR(comma_sep, ", ");
joined = PyUnicode_Join(&_Py_STR(comma_sep), sorted_methods);
method_count = PyObject_Length(sorted_methods);
Py_DECREF(sorted_methods);
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 71dfa64..1712533 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -458,12 +458,12 @@ proxy_checkref(PyWeakReference *proxy)
return res; \
}
-#define WRAP_METHOD(method, special) \
+#define WRAP_METHOD(method, SPECIAL) \
static PyObject * \
method(PyObject *proxy, PyObject *Py_UNUSED(ignored)) { \
UNWRAP(proxy); \
Py_INCREF(proxy); \
- PyObject* res = PyObject_CallMethodNoArgs(proxy, &_Py_ID(special)); \
+ PyObject* res = PyObject_CallMethodNoArgs(proxy, &_Py_ID(SPECIAL)); \
Py_DECREF(proxy); \
return res; \
}