summaryrefslogtreecommitdiffstats
path: root/Include/ceval.h
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-03-14 09:00:59 (GMT)
committerGitHub <noreply@github.com>2017-03-14 09:00:59 (GMT)
commitaa289a59ff6398110e1122877c073c9354ee53db (patch)
tree9861df74503cb7556be87ec43642efb5c4790748 /Include/ceval.h
parent7e2a54cdd977078b40b82182e46b201f8163f659 (diff)
downloadcpython-aa289a59ff6398110e1122877c073c9354ee53db.zip
cpython-aa289a59ff6398110e1122877c073c9354ee53db.tar.gz
cpython-aa289a59ff6398110e1122877c073c9354ee53db.tar.bz2
bpo-29548: Recommend PyObject_Call APIs over PyEval_Call APIs. (GH-75)
PyEval_Call* APIs are not documented and they doesn't respect PY_SSIZE_T_CLEAN. So add comment block which recommends PyObject_Call* APIs to ceval.h. This commit also changes PyEval_CallMethod and PyEval_CallFunction implementation same to PyObject_CallMethod and PyObject_CallFunction to reduce future maintenance cost. Optimization to avoid temporary tuple are copied too. PyEval_CallFunction(callable, "i", (int)i) now calls callable(i) instead of raising TypeError. But accepting this edge case is backward compatible.
Diffstat (limited to 'Include/ceval.h')
-rw-r--r--Include/ceval.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/ceval.h b/Include/ceval.h
index e4be595..8760fe5 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -7,6 +7,12 @@ extern "C" {
/* Interface to random parts in ceval.c */
+/* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction
+ * and PyEval_CallMethod are kept for backward compatibility: PyObject_Call(),
+ * PyObject_CallFunction() and PyObject_CallMethod() are recommended to call
+ * a callable object.
+ */
+
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
PyObject *callable,
PyObject *args,