summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-12 06:38:19 (GMT)
committerGitHub <noreply@github.com>2021-10-12 06:38:19 (GMT)
commitd943d19172aa93ce88bade15b9f23a0ce3bc72ff (patch)
treec674b910e203113b991861de5b12e2ab79eb166b /Modules
parentbe21706f3760bec8bd11f85ce02ed6792b07f51f (diff)
downloadcpython-d943d19172aa93ce88bade15b9f23a0ce3bc72ff.zip
cpython-d943d19172aa93ce88bade15b9f23a0ce3bc72ff.tar.gz
cpython-d943d19172aa93ce88bade15b9f23a0ce3bc72ff.tar.bz2
bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)
* Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_collectionsmodule.c1
-rw-r--r--Modules/_ctypes/_ctypes.c1
-rw-r--r--Modules/_ctypes/callbacks.c1
-rw-r--r--Modules/_ctypes/cfield.c1
-rw-r--r--Modules/_ctypes/stgdict.c1
-rw-r--r--Modules/_functoolsmodule.c1
-rw-r--r--Modules/_io/bufferedio.c1
-rw-r--r--Modules/_lsprof.c1
-rw-r--r--Modules/_sqlite/connection.c4
-rw-r--r--Modules/_ssl.c2
-rw-r--r--Modules/_testcapimodule.c12
-rw-r--r--Modules/itertoolsmodule.c3
-rw-r--r--Modules/main.c1
-rw-r--r--Modules/mathmodule.c3
-rw-r--r--Modules/posixmodule.c3
-rw-r--r--Modules/signalmodule.c2
16 files changed, 24 insertions, 14 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 8a690b4..c6de963 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_long.h" // _PyLong_GetZero()
#include "structmember.h" // PyMemberDef
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 7ff101e..2567067 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -102,6 +102,7 @@ bytes(cdata)
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "structmember.h" // PyMemberDef
#include <ffi.h>
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 16afb24..18b0104 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "frameobject.h"
#include <stdbool.h>
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 2909f2f..6788aee 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1,5 +1,6 @@
#include "Python.h"
#include "pycore_bitutils.h" // _Py_bswap32()
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include <ffi.h>
#ifdef MS_WIN32
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index d44b54c..ea3c58b 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include <ffi.h>
#ifdef MS_WIN32
#include <windows.h>
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index ed60ae3..4c77ee7 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_object.h" // _PyObject_GC_TRACK
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 74d4fb5..dc6371a 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -9,6 +9,7 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_object.h"
#include "structmember.h" // PyMemberDef
#include "_iomodule.h"
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c
index 0ca3f1e..097d0eff 100644
--- a/Modules/_lsprof.c
+++ b/Modules/_lsprof.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "rotatingtree.h"
/************************************************************/
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index a331757..b4badb1 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -710,7 +710,7 @@ step_callback(sqlite3_context *context, int argc, sqlite3_value **params)
if (*aggregate_instance == NULL) {
callback_context *ctx = (callback_context *)sqlite3_user_data(context);
assert(ctx != NULL);
- *aggregate_instance = _PyObject_CallNoArgs(ctx->callable);
+ *aggregate_instance = PyObject_CallNoArgs(ctx->callable);
if (!*aggregate_instance) {
set_sqlite_error(context,
"user-defined aggregate's '__init__' method raised error");
@@ -1008,7 +1008,7 @@ progress_callback(void *ctx)
assert(ctx != NULL);
PyObject *callable = ((callback_context *)ctx)->callable;
- ret = _PyObject_CallNoArgs(callable);
+ ret = PyObject_CallNoArgs(callable);
if (!ret) {
/* abort query if error occurred */
rc = -1;
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index c163ce6..b2e241a 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3773,7 +3773,7 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
}
if (pw_info->callable) {
- fn_ret = _PyObject_CallNoArgs(pw_info->callable);
+ fn_ret = PyObject_CallNoArgs(pw_info->callable);
if (!fn_ret) {
/* TODO: It would be nice to move _ctypes_add_traceback() into the
core python API, so we could use it to add a frame here */
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 775464c..7cbd2dc 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2866,7 +2866,7 @@ _make_call(void *callable)
PyObject *rc;
int success;
PyGILState_STATE s = PyGILState_Ensure();
- rc = _PyObject_CallNoArgs((PyObject *)callable);
+ rc = PyObject_CallNoArgs((PyObject *)callable);
success = (rc != NULL);
Py_XDECREF(rc);
PyGILState_Release(s);
@@ -2937,7 +2937,7 @@ static int _pending_callback(void *arg)
{
/* we assume the argument is callable object to which we own a reference */
PyObject *callable = (PyObject *)arg;
- PyObject *r = _PyObject_CallNoArgs(callable);
+ PyObject *r = PyObject_CallNoArgs(callable);
Py_DECREF(callable);
Py_XDECREF(r);
return r != NULL ? 0 : -1;
@@ -3729,7 +3729,7 @@ slot_tp_del(PyObject *self)
/* Execute __del__ method, if any. */
del = _PyObject_LookupSpecial(self, &PyId___tp_del__);
if (del != NULL) {
- res = _PyObject_CallNoArgs(del);
+ res = PyObject_CallNoArgs(del);
if (res == NULL)
PyErr_WriteUnraisable(del);
else
@@ -4358,7 +4358,7 @@ temporary_c_thread(void *data)
/* Allocate a Python thread state for this thread */
state = PyGILState_Ensure();
- res = _PyObject_CallNoArgs(test_c_thread->callback);
+ res = PyObject_CallNoArgs(test_c_thread->callback);
Py_CLEAR(test_c_thread->callback);
if (res == NULL) {
@@ -4893,7 +4893,7 @@ check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
#ifdef _Py_ADDRESS_SANITIZER
Py_RETURN_NONE;
#else
- PyObject *op = _PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
+ PyObject *op = PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
if (op == NULL) {
return NULL;
}
@@ -5271,7 +5271,7 @@ bad_get(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
return NULL;
}
- PyObject *res = _PyObject_CallNoArgs(cls);
+ PyObject *res = PyObject_CallNoArgs(cls);
if (res == NULL) {
return NULL;
}
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index d6f898c..342a3e6 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1,7 +1,6 @@
-
-
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "pycore_tuple.h" // _PyTuple_ITEMS()
diff --git a/Modules/main.c b/Modules/main.c
index 39b8c71..c537e6b 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -1,6 +1,7 @@
/* Python interpreter main program */
#include "Python.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_initconfig.h" // _PyArgv
#include "pycore_interp.h" // _PyInterpreterState.sysdict
#include "pycore_pathconfig.h" // _PyPathConfig_ComputeSysPath0()
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 62acece..4fac0cc 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -54,7 +54,8 @@ raised for division by zero and mod by zero.
#include "Python.h"
#include "pycore_bitutils.h" // _Py_bit_length()
-#include "pycore_dtoa.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
+#include "pycore_dtoa.h" // _Py_dg_infinity()
#include "pycore_long.h" // _PyLong_GetZero()
#include "_math.h"
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 01012c1..ada1a58 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -10,7 +10,8 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
-#include "pycore_fileutils.h"
+#include "pycore_call.h" // _PyObject_CallNoArgs()
+#include "pycore_fileutils.h" // _Py_closerange()
#include "pycore_moduleobject.h" // _PyModule_GetState()
#ifdef MS_WINDOWS
/* include <windows.h> early to avoid conflict with pycore_condvar.h:
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index d5e6a43..6568a4d 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -7,7 +7,7 @@
#include "pycore_atomic.h" // _Py_atomic_int
#include "pycore_call.h" // _PyObject_Call()
#include "pycore_ceval.h" // _PyEval_SignalReceived()
-#include "pycore_frame.h"
+#include "pycore_frame.h" // InterpreterFrame
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_pyerrors.h" // _PyErr_SetString()
#include "pycore_pylifecycle.h" // NSIG