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().
This commit is contained in:
Victor Stinner 2021-10-12 08:38:19 +02:00 committed by GitHub
parent be21706f37
commit d943d19172
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 89 additions and 64 deletions

View file

@ -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;
}