summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-12-04 22:59:09 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-12-04 22:59:09 +0100
commit39ae5bedd90f9caf9a78efa82f4d11e838933b3a (patch)
treea9f91cad2fb1b0d9f0e49134870d02416d154b92 /Objects
parent438fb1c0033ffd1ba2a9976a72654de0dbe4ec97 (diff)
downloadcpython-39ae5bedd90f9caf9a78efa82f4d11e838933b3a.tar.gz
Backed out changeset b9c9691c72c5
Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c8
-rw-r--r--Objects/bytearrayobject.c6
-rw-r--r--Objects/bytesobject.c7
-rw-r--r--Objects/complexobject.c2
-rw-r--r--Objects/descrobject.c2
-rw-r--r--Objects/dictobject.c3
-rw-r--r--Objects/enumobject.c2
-rw-r--r--Objects/floatobject.c2
-rw-r--r--Objects/genobject.c4
-rw-r--r--Objects/listobject.c3
-rw-r--r--Objects/longobject.c3
-rw-r--r--Objects/memoryobject.c4
-rw-r--r--Objects/object.c4
-rw-r--r--Objects/odictobject.c2
-rw-r--r--Objects/typeobject.c6
-rw-r--r--Objects/unicodeobject.c10
-rw-r--r--Objects/weakrefobject.c2
17 files changed, 40 insertions, 30 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 2f238ed0f1..beb12c98f6 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -103,7 +103,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
}
return defaultvalue;
}
- result = _PyObject_CallNoArg(hint);
+ result = PyObject_CallFunctionObjArgs(hint, NULL);
Py_DECREF(hint);
if (result == NULL) {
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
@@ -716,7 +716,7 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
}
/* And call it. */
- result = _PyObject_CallArg1(meth, format_spec);
+ result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL);
Py_DECREF(meth);
if (result && !PyUnicode_Check(result)) {
@@ -3011,7 +3011,7 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
Py_DECREF(checker);
return ok;
}
- res = _PyObject_CallArg1(checker, inst);
+ res = PyObject_CallFunctionObjArgs(checker, inst, NULL);
Py_LeaveRecursiveCall();
Py_DECREF(checker);
if (res != NULL) {
@@ -3085,7 +3085,7 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
Py_DECREF(checker);
return ok;
}
- res = _PyObject_CallArg1(checker, derived);
+ res = PyObject_CallFunctionObjArgs(checker, derived, NULL);
Py_LeaveRecursiveCall();
Py_DECREF(checker);
if (res != NULL) {
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 853156eabc..16b4fd7a90 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -98,7 +98,8 @@ _canresize(PyByteArrayObject *self)
PyObject *
PyByteArray_FromObject(PyObject *input)
{
- return _PyObject_CallArg1((PyObject *)&PyByteArray_Type, input);
+ return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type,
+ input, NULL);
}
PyObject *
@@ -1984,7 +1985,8 @@ bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
{
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
if (type != &PyByteArray_Type && result != NULL) {
- Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result));
+ Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
+ result, NULL));
}
return result;
}
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index b82945ab1d..5cdc2ca30e 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -549,7 +549,7 @@ format_obj(PyObject *v, const char **pbuf, Py_ssize_t *plen)
/* does it support __bytes__? */
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
if (func != NULL) {
- result = _PyObject_CallNoArg(func);
+ result = PyObject_CallFunctionObjArgs(func, NULL);
Py_DECREF(func);
if (result == NULL)
return NULL;
@@ -2331,7 +2331,8 @@ bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
{
PyObject *result = _PyBytes_FromHex(string, 0);
if (type != &PyBytes_Type && result != NULL) {
- Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result));
+ Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
+ result, NULL));
}
return result;
}
@@ -2568,7 +2569,7 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject_Bytes doesn't do. */
func = _PyObject_LookupSpecial(x, &PyId___bytes__);
if (func != NULL) {
- new = _PyObject_CallNoArg(func);
+ new = PyObject_CallFunctionObjArgs(func, NULL);
Py_DECREF(func);
if (new == NULL)
return NULL;
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 0d391e5208..31e12784cc 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -273,7 +273,7 @@ try_complex_special_method(PyObject *op) {
f = _PyObject_LookupSpecial(op, &PyId___complex__);
if (f) {
- PyObject *res = _PyObject_CallNoArg(f);
+ PyObject *res = PyObject_CallFunctionObjArgs(f, NULL);
Py_DECREF(f);
if (res != NULL && !PyComplex_Check(res)) {
PyErr_SetString(PyExc_TypeError,
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 82cc181029..076e741481 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1414,7 +1414,7 @@ property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
return -1;
}
if (value == NULL)
- res = _PyObject_CallArg1(func, obj);
+ res = PyObject_CallFunctionObjArgs(func, obj, NULL);
else
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
if (res == NULL)
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index b74941ac29..2a01f70b71 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2066,7 +2066,8 @@ dict_subscript(PyDictObject *mp, PyObject *key)
_Py_IDENTIFIER(__missing__);
missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__);
if (missing != NULL) {
- res = _PyObject_CallArg1(missing, key);
+ res = PyObject_CallFunctionObjArgs(missing,
+ key, NULL);
Py_DECREF(missing);
return res;
}
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index 72d31b16af..dae166d5ad 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -258,7 +258,7 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
if (reversed_meth != NULL) {
- PyObject *res = _PyObject_CallNoArg(reversed_meth);
+ PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL);
Py_DECREF(reversed_meth);
return res;
}
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 997d1f9665..17a55dd114 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1439,7 +1439,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
goto parse_error;
result = PyFloat_FromDouble(negate ? -x : x);
if (cls != (PyObject *)&PyFloat_Type && result != NULL) {
- Py_SETREF(result, _PyObject_CallArg1(cls, result));
+ Py_SETREF(result, PyObject_CallFunctionObjArgs(cls, result, NULL));
}
return result;
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 0484b1c677..bd7873bceb 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -43,7 +43,7 @@ _PyGen_Finalize(PyObject *self)
/* Save the current exception, if any. */
PyErr_Fetch(&error_type, &error_value, &error_traceback);
- res = _PyObject_CallArg1(finalizer, self);
+ res = PyObject_CallFunctionObjArgs(finalizer, self, NULL);
if (res == NULL) {
PyErr_WriteUnraisable(self);
@@ -591,7 +591,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
*
* (See PyErr_SetObject/_PyErr_CreateException code for details.)
*/
- e = _PyObject_CallArg1(PyExc_StopIteration, value);
+ e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL);
if (e == NULL) {
return -1;
}
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 81b6c48557..dcd7b5efe5 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1970,7 +1970,8 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
}
for (i = 0; i < saved_ob_size ; i++) {
- keys[i] = _PyObject_CallArg1(keyfunc, saved_ob_item[i]);
+ keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i],
+ NULL);
if (keys[i] == NULL) {
for (i=i-1 ; i>=0 ; i--)
Py_DECREF(keys[i]);
diff --git a/Objects/longobject.c b/Objects/longobject.c
index b9f6327759..c95f9467ad 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -5282,7 +5282,8 @@ long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(bytes);
if (type != &PyLong_Type) {
- Py_SETREF(long_obj, _PyObject_CallArg1((PyObject *)type, long_obj));
+ Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type,
+ long_obj, NULL));
}
return long_obj;
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index eac07fbc03..428d83c987 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -1939,7 +1939,7 @@ struct_get_unpacker(const char *fmt, Py_ssize_t itemsize)
if (format == NULL)
goto error;
- structobj = _PyObject_CallArg1(Struct, format);
+ structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
if (structobj == NULL)
goto error;
@@ -1978,7 +1978,7 @@ struct_unpack_single(const char *ptr, struct unpacker *x)
PyObject *v;
memcpy(x->item, ptr, x->itemsize);
- v = _PyObject_CallArg1(x->unpack_from, x->mview);
+ v = PyObject_CallFunctionObjArgs(x->unpack_from, x->mview, NULL);
if (v == NULL)
return NULL;
diff --git a/Objects/object.c b/Objects/object.c
index 4844bd7669..d88ae3b94f 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -596,7 +596,7 @@ PyObject_Bytes(PyObject *v)
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
if (func != NULL) {
- result = _PyObject_CallNoArg(func);
+ result = PyObject_CallFunctionObjArgs(func, NULL);
Py_DECREF(func);
if (result == NULL)
return NULL;
@@ -1314,7 +1314,7 @@ _dir_object(PyObject *obj)
return NULL;
}
/* use __dir__ */
- result = _PyObject_CallNoArg(dirfunc);
+ result = PyObject_CallFunctionObjArgs(dirfunc, NULL);
Py_DECREF(dirfunc);
if (result == NULL)
return NULL;
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 77fb3a181d..22b1f1dfed 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -1256,7 +1256,7 @@ odict_copy(register PyODictObject *od)
if (PyODict_CheckExact(od))
od_copy = PyODict_New();
else
- od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od));
+ od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL);
if (od_copy == NULL)
return NULL;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index a9f352046c..186c57016c 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3487,7 +3487,9 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
sorted = _PyDict_GetItemId(builtins, &PyId_sorted);
if (sorted == NULL)
goto error;
- sorted_methods = _PyObject_CallArg1(sorted, abstract_methods);
+ sorted_methods = PyObject_CallFunctionObjArgs(sorted,
+ abstract_methods,
+ NULL);
if (sorted_methods == NULL)
goto error;
comma = _PyUnicode_FromId(&comma_id);
@@ -6191,7 +6193,7 @@ call_attribute(PyObject *self, PyObject *attr, PyObject *name)
else
attr = descr;
}
- res = _PyObject_CallArg1(attr, name);
+ res = PyObject_CallFunctionObjArgs(attr, name, NULL);
Py_XDECREF(descr);
return res;
}
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 8f6f6c675f..1c2257e141 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4269,7 +4269,7 @@ unicode_decode_call_errorhandler_wchar(
if (*exceptionObject == NULL)
goto onError;
- restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
+ restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
if (restuple == NULL)
goto onError;
if (!PyTuple_Check(restuple)) {
@@ -4368,7 +4368,7 @@ unicode_decode_call_errorhandler_writer(
if (*exceptionObject == NULL)
goto onError;
- restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
+ restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
if (restuple == NULL)
goto onError;
if (!PyTuple_Check(restuple)) {
@@ -6649,7 +6649,8 @@ unicode_encode_call_errorhandler(const char *errors,
if (*exceptionObject == NULL)
return NULL;
- restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
+ restuple = PyObject_CallFunctionObjArgs(
+ *errorHandler, *exceptionObject, NULL);
if (restuple == NULL)
return NULL;
if (!PyTuple_Check(restuple)) {
@@ -8643,7 +8644,8 @@ unicode_translate_call_errorhandler(const char *errors,
if (*exceptionObject == NULL)
return NULL;
- restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
+ restuple = PyObject_CallFunctionObjArgs(
+ *errorHandler, *exceptionObject, NULL);
if (restuple == NULL)
return NULL;
if (!PyTuple_Check(restuple)) {
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 2f33aed026..ab6b235255 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -867,7 +867,7 @@ PyWeakref_GetObject(PyObject *ref)
static void
handle_callback(PyWeakReference *ref, PyObject *callback)
{
- PyObject *cbresult = _PyObject_CallArg1(callback, ref);
+ PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL);
if (cbresult == NULL)
PyErr_WriteUnraisable(callback);