summaryrefslogtreecommitdiff
path: root/Modules/_datetimemodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-09-05 17:53:15 -0700
committerVictor Stinner <victor.stinner@gmail.com>2016-09-05 17:53:15 -0700
commitad8c83ad6b91bebbc124c0c36e67b9836ca3d90f (patch)
tree18c2f0bdd40db2aa568b9e4a5f87d2f88ff70059 /Modules/_datetimemodule.c
parentca08301ae0cc5e4e7b57e2283542815efbff86bb (diff)
downloadcpython-git-ad8c83ad6b91bebbc124c0c36e67b9836ca3d90f.tar.gz
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 'Modules/_datetimemodule.c')
-rw-r--r--Modules/_datetimemodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 7e95af7497..b48dc2dff3 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -1378,7 +1378,7 @@ time_time(void)
if (time != NULL) {
_Py_IDENTIFIER(time);
- result = _PyObject_CallMethodId(time, &PyId_time, "()");
+ result = _PyObject_CallMethodId(time, &PyId_time, NULL);
Py_DECREF(time);
}
return result;
@@ -2703,7 +2703,7 @@ date_isoformat(PyDateTime_Date *self)
static PyObject *
date_str(PyDateTime_Date *self)
{
- return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "()");
+ return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, NULL);
}
@@ -2729,7 +2729,7 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
&format))
return NULL;
- tuple = _PyObject_CallMethodId((PyObject *)self, &PyId_timetuple, "()");
+ tuple = _PyObject_CallMethodId((PyObject *)self, &PyId_timetuple, NULL);
if (tuple == NULL)
return NULL;
result = wrap_strftime((PyObject *)self, format, tuple,
@@ -3675,7 +3675,7 @@ time_repr(PyDateTime_Time *self)
static PyObject *
time_str(PyDateTime_Time *self)
{
- return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "()");
+ return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, NULL);
}
static PyObject *