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/faulthandler.c b/Modules/faulthandler.c
index 06f7f2e..11d5340 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -146,6 +146,8 @@
faulthandler_get_fileno(PyObject *file, int *p_fd)
{
PyObject *result;
+ _Py_identifier(fileno);
+ _Py_identifier(flush);
long fd_long;
int fd;
@@ -157,7 +159,7 @@
}
}
- result = PyObject_CallMethod(file, "fileno", "");
+ result = _PyObject_CallMethodId(file, &PyId_fileno, "");
if (result == NULL)
return NULL;
@@ -175,7 +177,7 @@
return NULL;
}
- result = PyObject_CallMethod(file, "flush", "");
+ result = _PyObject_CallMethodId(file, &PyId_flush, "");
if (result != NULL)
Py_DECREF(result);
else {
@@ -1197,6 +1199,7 @@
faulthandler_env_options(void)
{
PyObject *xoptions, *key, *module, *res;
+ _Py_identifier(enable);
if (!Py_GETENV("PYTHONFAULTHANDLER")) {
int has_key;
@@ -1219,7 +1222,7 @@
if (module == NULL) {
return -1;
}
- res = PyObject_CallMethod(module, "enable", "");
+ res = _PyObject_CallMethodId(module, &PyId_enable, "");
Py_DECREF(module);
if (res == NULL)
return -1;