pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/7bfb42d5b7721ca26e33050d025fec5c43c00058

b48faa60c69660fa.css" /> Issue #28858: Remove _PyObject_CallArg1() macro · python/cpython@7bfb42d · GitHub
Skip to content

Commit 7bfb42d

Browse files
committed
Issue #28858: Remove _PyObject_CallArg1() macro
Replace _PyObject_CallArg1(func, arg) with PyObject_CallFunctionObjArgs(func, arg, NULL) Using the _PyObject_CallArg1() macro increases the usage of the C stack, which was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this issue.
1 parent d77e5b7 commit 7bfb42d

15 files changed

Lines changed: 25 additions & 26 deletions

Include/abstract.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
338338
_PyObject_FastCallDict((func), (args), (nargs), NULL)
339339

340340
#define _PyObject_CallNoArg(func) \
341-
_PyObject_FastCall((func), NULL, 0)
342-
343-
#define _PyObject_CallArg1(func, arg) \
344-
_PyObject_FastCall((func), (PyObject **)&(arg), 1)
341+
_PyObject_FastCallDict((func), NULL, 0, NULL)
345342

346343
PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func,
347344
PyObject *obj, PyObject *args,

Modules/_asynciomodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ future_get_result(FutureObj *fut, PyObject **result)
257257
return -1;
258258
}
259259

260-
exc = _PyObject_CallArg1(asyncio_InvalidStateError, msg);
260+
exc = PyObject_CallFunctionObjArgs(asyncio_InvalidStateError, msg, NULL);
261261
Py_DECREF(msg);
262262
if (exc == NULL) {
263263
return -1;
@@ -835,7 +835,7 @@ FutureObj_finalize(FutureObj *fut)
835835

836836
func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler);
837837
if (func != NULL) {
838-
res = _PyObject_CallArg1(func, context);
838+
res = PyObject_CallFunctionObjArgs(func, context, NULL);
839839
if (res == NULL) {
840840
PyErr_WriteUnraisable(func);
841841
}
@@ -1731,7 +1731,7 @@ TaskObj_finalize(TaskObj *task)
17311731

17321732
func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler);
17331733
if (func != NULL) {
1734-
res = _PyObject_CallArg1(func, context);
1734+
res = PyObject_CallFunctionObjArgs(func, context, NULL);
17351735
if (res == NULL) {
17361736
PyErr_WriteUnraisable(func);
17371737
}

Modules/_collectionsmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ deque_copy(PyObject *deque)
538538
return NULL;
539539
}
540540
if (old_deque->maxlen < 0)
541-
return _PyObject_CallArg1((PyObject *)(Py_TYPE(deque)), deque);
541+
return PyObject_CallFunctionObjArgs((PyObject *)(Py_TYPE(deque)),
542+
deque, NULL);
542543
else
543544
return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi",
544545
deque, old_deque->maxlen, NULL);

Modules/_elementtree.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2831,7 +2831,7 @@ expat_set_error(enum XML_Error error_code, Py_ssize_t line, Py_ssize_t column,
28312831
if (errmsg == NULL)
28322832
return;
28332833

2834-
error = _PyObject_CallArg1(st->parseerror_obj, errmsg);
2834+
error = PyObject_CallFunctionObjArgs(st->parseerror_obj, errmsg, NULL);
28352835
Py_DECREF(errmsg);
28362836
if (!error)
28372837
return;
@@ -2894,7 +2894,7 @@ expat_default_handler(XMLParserObject* self, const XML_Char* data_in,
28942894
(TreeBuilderObject*) self->target, value
28952895
);
28962896
else if (self->handle_data)
2897-
res = _PyObject_CallArg1(self->handle_data, value);
2897+
res = PyObject_CallFunctionObjArgs(self->handle_data, value, NULL);
28982898
else
28992899
res = NULL;
29002900
Py_XDECREF(res);
@@ -3004,7 +3004,7 @@ expat_data_handler(XMLParserObject* self, const XML_Char* data_in,
30043004
/* shortcut */
30053005
res = treebuilder_handle_data((TreeBuilderObject*) self->target, data);
30063006
else if (self->handle_data)
3007-
res = _PyObject_CallArg1(self->handle_data, data);
3007+
res = PyObject_CallFunctionObjArgs(self->handle_data, data, NULL);
30083008
else
30093009
res = NULL;
30103010

@@ -3031,7 +3031,7 @@ expat_end_handler(XMLParserObject* self, const XML_Char* tag_in)
30313031
else if (self->handle_end) {
30323032
tag = makeuniversal(self, tag_in);
30333033
if (tag) {
3034-
res = _PyObject_CallArg1(self->handle_end, tag);
3034+
res = PyObject_CallFunctionObjArgs(self->handle_end, tag, NULL);
30353035
Py_DECREF(tag);
30363036
}
30373037
}
@@ -3090,7 +3090,8 @@ expat_comment_handler(XMLParserObject* self, const XML_Char* comment_in)
30903090
if (self->handle_comment) {
30913091
comment = PyUnicode_DecodeUTF8(comment_in, strlen(comment_in), "strict");
30923092
if (comment) {
3093-
res = _PyObject_CallArg1(self->handle_comment, comment);
3093+
res = PyObject_CallFunctionObjArgs(self->handle_comment,
3094+
comment, NULL);
30943095
Py_XDECREF(res);
30953096
Py_DECREF(comment);
30963097
}

Modules/_pickle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ _Pickle_FastCall(PyObject *func, PyObject *obj)
346346
{
347347
PyObject *result;
348348

349-
result = _PyObject_CallArg1(func, obj);
349+
result = PyObject_CallFunctionObjArgs(func, obj, NULL);
350350
Py_DECREF(obj);
351351
return result;
352352
}

Modules/_sre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
11571157
match = pattern_new_match(self, &state, 1);
11581158
if (!match)
11591159
goto error;
1160-
item = _PyObject_CallArg1(filter, match);
1160+
item = PyObject_CallFunctionObjArgs(filter, match, NULL);
11611161
Py_DECREF(match);
11621162
if (!item)
11631163
goto error;

Modules/pyexpat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ set_error(xmlparseobject *self, enum XML_Error code)
119119
XML_ErrorString(code), lineno, column);
120120
if (buffer == NULL)
121121
return NULL;
122-
err = _PyObject_CallArg1(ErrorObject, buffer);
122+
err = PyObject_CallFunctionObjArgs(ErrorObject, buffer, NULL);
123123
Py_DECREF(buffer);
124124
if ( err != NULL
125125
&& set_error_attr(err, "code", code)

Objects/abstract.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ call_function_tail(PyObject *callable, PyObject *args)
24962496
assert(args != NULL);
24972497

24982498
if (!PyTuple_Check(args)) {
2499-
result = _PyObject_CallArg1(callable, args);
2499+
result = PyObject_CallFunctionObjArgs(callable, args, NULL);
25002500
}
25012501
else {
25022502
result = PyObject_Call(callable, args, NULL);

Objects/fileobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
146146
Py_DECREF(writer);
147147
return -1;
148148
}
149-
result = _PyObject_CallArg1(writer, value);
149+
result = PyObject_CallFunctionObjArgs(writer, value, NULL);
150150
Py_DECREF(value);
151151
Py_DECREF(writer);
152152
if (result == NULL)

Objects/genobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ async_gen_init_hooks(PyAsyncGenObject *o)
13411341
PyObject *res;
13421342

13431343
Py_INCREF(firstiter);
1344-
res = _PyObject_CallArg1(firstiter, o);
1344+
res = PyObject_CallFunctionObjArgs(firstiter, o, NULL);
13451345
Py_DECREF(firstiter);
13461346
if (res == NULL) {
13471347
return 1;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy