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/Modules/socketmodule.c b/Modules/socketmodule.c
index e64c960..6d0a44c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -4821,7 +4821,9 @@
if (hobj == Py_None) {
hptr = NULL;
} else if (PyUnicode_Check(hobj)) {
- idna = PyObject_CallMethod(hobj, "encode", "s", "idna");
+ _Py_identifier(encode);
+
+ idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna");
if (!idna)
return NULL;
assert(PyBytes_Check(idna));