Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index c99f6ba..594f0ea 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -440,8 +440,9 @@
#define WRAP_METHOD(method, special) \
static PyObject * \
method(PyObject *proxy) { \
+ _Py_identifier(special); \
UNWRAP(proxy); \
- return PyObject_CallMethod(proxy, special, ""); \
+ return _PyObject_CallMethodId(proxy, &PyId_##special, ""); \
}
@@ -584,7 +585,7 @@
}
-WRAP_METHOD(proxy_bytes, "__bytes__")
+WRAP_METHOD(proxy_bytes, __bytes__)
static PyMethodDef proxy_methods[] = {