summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-09-06 01:16:01 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-09-06 01:16:01 (GMT)
commit3466bde1cc113750450ffed028cc6fc7c95faedd (patch)
tree231febf716064e61b742a058c60da523c8b30fe3 /Modules
parentad8c83ad6b91bebbc124c0c36e67b9836ca3d90f (diff)
downloadcpython-3466bde1cc113750450ffed028cc6fc7c95faedd.zip
cpython-3466bde1cc113750450ffed028cc6fc7c95faedd.tar.gz
cpython-3466bde1cc113750450ffed028cc6fc7c95faedd.tar.bz2
Avoid calling functions with an empty string as format string
Directly pass NULL rather than an empty string.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_cursesmodule.c2
-rw-r--r--Modules/_elementtree.c2
-rw-r--r--Modules/_sqlite/connection.c16
-rw-r--r--Modules/_sqlite/cursor.c2
-rw-r--r--Modules/_sqlite/module.c2
-rw-r--r--Modules/_testcapimodule.c4
-rw-r--r--Modules/faulthandler.c6
7 files changed, 17 insertions, 17 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 960752c..a48735f 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2306,7 +2306,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
goto error;
}
- data = _PyObject_CallMethodId(stream, &PyId_read, "");
+ data = _PyObject_CallMethodId(stream, &PyId_read, NULL);
if (data == NULL)
goto error;
if (!PyBytes_Check(data)) {
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 721293a..39eba7c 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3399,7 +3399,7 @@ _elementtree_XMLParser_close_impl(XMLParserObject *self)
}
else if (self->handle_close) {
Py_DECREF(res);
- return PyObject_CallFunction(self->handle_close, "");
+ return _PyObject_CallNoArg(self->handle_close);
}
else {
return res;
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 409fa74..4a10ce5 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -672,7 +672,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_
aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*));
if (*aggregate_instance == 0) {
- *aggregate_instance = PyObject_CallFunction(aggregate_class, "");
+ *aggregate_instance = PyObject_CallFunction(aggregate_class, NULL);
if (PyErr_Occurred()) {
*aggregate_instance = 0;
@@ -744,7 +744,7 @@ void _pysqlite_final_callback(sqlite3_context* context)
PyErr_Fetch(&exception, &value, &tb);
restore = 1;
- function_result = _PyObject_CallMethodId(*aggregate_instance, &PyId_finalize, "");
+ function_result = _PyObject_CallMethodId(*aggregate_instance, &PyId_finalize, NULL);
Py_DECREF(*aggregate_instance);
@@ -960,7 +960,7 @@ static int _progress_handler(void* user_arg)
gilstate = PyGILState_Ensure();
#endif
- ret = PyObject_CallFunction((PyObject*)user_arg, "");
+ ret = PyObject_CallFunction((PyObject*)user_arg, NULL);
if (!ret) {
if (_enable_callback_tracebacks) {
@@ -1291,7 +1291,7 @@ PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args)
PyObject* result = 0;
PyObject* method = 0;
- cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
+ cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, NULL);
if (!cursor) {
goto error;
}
@@ -1320,7 +1320,7 @@ PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* a
PyObject* result = 0;
PyObject* method = 0;
- cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
+ cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, NULL);
if (!cursor) {
goto error;
}
@@ -1349,7 +1349,7 @@ PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject*
PyObject* result = 0;
PyObject* method = 0;
- cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
+ cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, NULL);
if (!cursor) {
goto error;
}
@@ -1519,7 +1519,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
goto finally;
}
- uppercase_name = _PyObject_CallMethodId(name, &PyId_upper, "");
+ uppercase_name = _PyObject_CallMethodId(name, &PyId_upper, NULL);
if (!uppercase_name) {
goto finally;
}
@@ -1611,7 +1611,7 @@ pysqlite_connection_exit(pysqlite_Connection* self, PyObject* args)
method_name = "rollback";
}
- result = PyObject_CallMethod((PyObject*)self, method_name, "");
+ result = PyObject_CallMethod((PyObject*)self, method_name, NULL);
if (!result) {
return NULL;
}
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 98eb961..e2c7a34 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -143,7 +143,7 @@ PyObject* _pysqlite_get_converter(PyObject* key)
PyObject* retval;
_Py_IDENTIFIER(upper);
- upcase_key = _PyObject_CallMethodId(key, &PyId_upper, "");
+ upcase_key = _PyObject_CallMethodId(key, &PyId_upper, NULL);
if (!upcase_key) {
return NULL;
}
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index 7cd6d2a..cc45331 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -192,7 +192,7 @@ static PyObject* module_register_converter(PyObject* self, PyObject* args)
}
/* convert the name to upper case */
- name = _PyObject_CallMethodId(orig_name, &PyId_upper, "");
+ name = _PyObject_CallMethodId(orig_name, &PyId_upper, NULL);
if (!name) {
goto error;
}
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 7b6c2c1..2fb5a14 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2137,7 +2137,7 @@ _make_call(void *callable)
PyObject *rc;
int success;
PyGILState_STATE s = PyGILState_Ensure();
- rc = PyObject_CallFunction((PyObject *)callable, "");
+ rc = _PyObject_CallNoArg((PyObject *)callable);
success = (rc != NULL);
Py_XDECREF(rc);
PyGILState_Release(s);
@@ -3406,7 +3406,7 @@ temporary_c_thread(void *data)
/* Allocate a Python thread state for this thread */
state = PyGILState_Ensure();
- res = PyObject_CallFunction(test_c_thread->callback, "", NULL);
+ res = _PyObject_CallNoArg(test_c_thread->callback);
Py_CLEAR(test_c_thread->callback);
if (res == NULL) {
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index d6322d0..8969b4c 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -168,7 +168,7 @@ faulthandler_get_fileno(PyObject **file_ptr)
return fd;
}
- result = _PyObject_CallMethodId(file, &PyId_fileno, "");
+ result = _PyObject_CallMethodId(file, &PyId_fileno, NULL);
if (result == NULL)
return -1;
@@ -186,7 +186,7 @@ faulthandler_get_fileno(PyObject **file_ptr)
return -1;
}
- result = _PyObject_CallMethodId(file, &PyId_flush, "");
+ result = _PyObject_CallMethodId(file, &PyId_flush, NULL);
if (result != NULL)
Py_DECREF(result);
else {
@@ -1290,7 +1290,7 @@ faulthandler_env_options(void)
if (module == NULL) {
return -1;
}
- res = _PyObject_CallMethodId(module, &PyId_enable, "");
+ res = _PyObject_CallMethodId(module, &PyId_enable, NULL);
Py_DECREF(module);
if (res == NULL)
return -1;