mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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
This commit is contained in:
parent
278fdd3e3a
commit
12360aa159
9 changed files with 103 additions and 274 deletions
|
@ -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);
|
||||
|
|
|
@ -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; \
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue