diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-06 00:53:15 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-06 00:53:15 (GMT) |
commit | ad8c83ad6b91bebbc124c0c36e67b9836ca3d90f (patch) | |
tree | 18c2f0bdd40db2aa568b9e4a5f87d2f88ff70059 /Objects | |
parent | ca08301ae0cc5e4e7b57e2283542815efbff86bb (diff) | |
download | cpython-ad8c83ad6b91bebbc124c0c36e67b9836ca3d90f.zip cpython-ad8c83ad6b91bebbc124c0c36e67b9836ca3d90f.tar.gz cpython-ad8c83ad6b91bebbc124c0c36e67b9836ca3d90f.tar.bz2 |
Avoid inefficient way to call functions without argument
Don't pass "()" format to PyObject_CallXXX() to call a function without
argument: pass NULL as the format string instead. It avoids to have to parse a
string to produce 0 argument.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6cffb4e..209d4fa 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5758,7 +5758,7 @@ static PyObject * \ FUNCNAME(PyObject *self) \ { \ _Py_static_string(id, OPSTR); \ - return call_method(self, &id, "()"); \ + return call_method(self, &id, NULL); \ } #define SLOT1(FUNCNAME, OPSTR, ARG1TYPE, ARGCODES) \ @@ -5851,7 +5851,7 @@ FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \ static Py_ssize_t slot_sq_length(PyObject *self) { - PyObject *res = call_method(self, &PyId___len__, "()"); + PyObject *res = call_method(self, &PyId___len__, NULL); Py_ssize_t len; if (res == NULL) @@ -6065,7 +6065,7 @@ static PyObject * slot_nb_index(PyObject *self) { _Py_IDENTIFIER(__index__); - return call_method(self, &PyId___index__, "()"); + return call_method(self, &PyId___index__, NULL); } @@ -6351,7 +6351,7 @@ static PyObject * slot_tp_iternext(PyObject *self) { _Py_IDENTIFIER(__next__); - return call_method(self, &PyId___next__, "()"); + return call_method(self, &PyId___next__, NULL); } static PyObject * |