diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-12-08 23:33:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-12-08 23:33:39 (GMT) |
commit | 4c38154a432885a933b539c2682e66caaf440117 (patch) | |
tree | 84f6d0fbe46ac26057383ea0606754f7d28eec0c | |
parent | ef7def94c7c681a10031e88efd6511f5c4ff2c75 (diff) | |
download | cpython-4c38154a432885a933b539c2682e66caaf440117.zip cpython-4c38154a432885a933b539c2682e66caaf440117.tar.gz cpython-4c38154a432885a933b539c2682e66caaf440117.tar.bz2 |
Don't parenthesis in _PyObject_CallMethodId() format
Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation
a temporary tuple, and so is more efficient.
-rw-r--r-- | Modules/_datetimemodule.c | 2 | ||||
-rw-r--r-- | Modules/_decimal/_decimal.c | 2 | ||||
-rw-r--r-- | Modules/_json.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index c14aa4f..0999218 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -4673,7 +4673,7 @@ datetime_repr(PyDateTime_DateTime *self) static PyObject * datetime_str(PyDateTime_DateTime *self) { - return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "(s)", " "); + return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "s", " "); } static PyObject * diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index 9797089..9e8625d 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -5716,7 +5716,7 @@ PyInit__decimal(void) /* DecimalTuple */ ASSIGN_PTR(collections, PyImport_ImportModule("collections")); ASSIGN_PTR(DecimalTuple, (PyTypeObject *)PyObject_CallMethod(collections, - "namedtuple", "(ss)", "DecimalTuple", + "namedtuple", "ss", "DecimalTuple", "sign digits exponent")); ASSIGN_PTR(obj, PyUnicode_FromString("decimal")); diff --git a/Modules/_json.c b/Modules/_json.c index d3dbf98..5cf39f2 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -335,7 +335,7 @@ raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end) if (JSONDecodeError == NULL) return; } - exc = PyObject_CallFunction(JSONDecodeError, "(zOn)", msg, s, end); + exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end); if (exc) { PyErr_SetObject(JSONDecodeError, exc); Py_DECREF(exc); |