Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c38154

Browse files
committed
Don't parenthesis in _PyObject_CallMethodId() format
Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation a temporary tuple, and so is more efficient.
1 parent ef7def9 commit 4c38154

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/_datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4673,7 +4673,7 @@ datetime_repr(PyDateTime_DateTime *self)
46734673
static PyObject *
46744674
datetime_str(PyDateTime_DateTime *self)
46754675
{
4676-
return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "(s)", " ");
4676+
return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "s", " ");
46774677
}
46784678

46794679
static PyObject *

Modules/_decimal/_decimal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5716,7 +5716,7 @@ PyInit__decimal(void)
57165716
/* DecimalTuple */
57175717
ASSIGN_PTR(collections, PyImport_ImportModule("collections"));
57185718
ASSIGN_PTR(DecimalTuple, (PyTypeObject *)PyObject_CallMethod(collections,
5719-
"namedtuple", "(ss)", "DecimalTuple",
5719+
"namedtuple", "ss", "DecimalTuple",
57205720
"sign digits exponent"));
57215721

57225722
ASSIGN_PTR(obj, PyUnicode_FromString("decimal"));

Modules/_json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end)
335335
if (JSONDecodeError == NULL)
336336
return;
337337
}
338-
exc = PyObject_CallFunction(JSONDecodeError, "(zOn)", msg, s, end);
338+
exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end);
339339
if (exc) {
340340
PyErr_SetObject(JSONDecodeError, exc);
341341
Py_DECREF(exc);

0 commit comments

Comments
 (0)