diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2022-02-15 00:36:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 00:36:51 (GMT) |
commit | 12360aa159c42c7798fd14225d271e6fd84db7eb (patch) | |
tree | ad2b4f0d67c90a5a0be4ff532082fc3468d6d65b /Objects | |
parent | 278fdd3e3a2492665b2c2888fd2f428f7f59a3f5 (diff) | |
download | cpython-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.c | 1 | ||||
-rw-r--r-- | Objects/weakrefobject.c | 4 |
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; \ } |