PHP 8.2.30
Preview: pycore_call.h Size: 3.39 KB
//opt/alt/python311/include/python3.11/internal/pycore_call.h

#ifndef Py_INTERNAL_CALL_H
#define Py_INTERNAL_CALL_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef Py_BUILD_CORE
#  error "this header requires Py_BUILD_CORE define"
#endif

#include "pycore_pystate.h"       // _PyThreadState_GET()

PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
    PyThreadState *tstate,
    PyObject *callable,
    PyObject *obj,
    PyObject *args,
    PyObject *kwargs);

PyAPI_FUNC(PyObject *) _PyObject_FastCallDictTstate(
    PyThreadState *tstate,
    PyObject *callable,
    PyObject *const *args,
    size_t nargsf,
    PyObject *kwargs);

PyAPI_FUNC(PyObject *) _PyObject_Call(
    PyThreadState *tstate,
    PyObject *callable,
    PyObject *args,
    PyObject *kwargs);

extern PyObject * _PyObject_CallMethodFormat(
        PyThreadState *tstate, PyObject *callable, const char *format, ...);


// Static inline variant of public PyVectorcall_Function().
static inline vectorcallfunc
_PyVectorcall_FunctionInline(PyObject *callable)
{
    assert(callable != NULL);

    PyTypeObject *tp = Py_TYPE(callable);
    if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
        return NULL;
    }
    assert(PyCallable_Check(callable));

    Py_ssize_t offset = tp->tp_vectorcall_offset;
    assert(offset > 0);

    vectorcallfunc ptr;
    memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
    return ptr;
}


/* Call the callable object 'callable' with the "vectorcall" calling
   convention.

   args is a C array for positional arguments.

   nargsf is the number of positional arguments plus optionally the flag
   PY_VECTORCALL_ARGUMENTS_OFFSET which means that the caller is allowed to
   modify args[-1].

   kwnames is a tuple of keyword names. The values of the keyword arguments
   are stored in "args" after the positional arguments (note that the number
   of keyword arguments does not change nargsf). kwnames can also be NULL if
   there are no keyword arguments.

   keywords must only contain strings and all keys must be unique.

   Return the result on success. Raise an exception and return NULL on
   error. */
static inline PyObject *
_PyObject_VectorcallTstate(PyThreadState *tstate, PyObject *callable,
                           PyObject *const *args, size_t nargsf,
                           PyObject *kwnames)
{
    vectorcallfunc func;
    PyObject *res;

    assert(kwnames == NULL || PyTuple_Check(kwnames));
    assert(args != NULL || PyVectorcall_NARGS(nargsf) == 0);

    func = _PyVectorcall_FunctionInline(callable);
    if (func == NULL) {
        Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
        return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwnames);
    }
    res = func(callable, args, nargsf, kwnames);
    return _Py_CheckFunctionResult(tstate, callable, res, NULL);
}


static inline PyObject *
_PyObject_CallNoArgsTstate(PyThreadState *tstate, PyObject *func) {
    return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
}


// Private static inline function variant of public PyObject_CallNoArgs()
static inline PyObject *
_PyObject_CallNoArgs(PyObject *func) {
    PyThreadState *tstate = _PyThreadState_GET();
    return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
}


static inline PyObject *
_PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func, PyObject *const *args, Py_ssize_t nargs)
{
    return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL);
}


#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_CALL_H */

Directory Contents

Dirs: 0 × Files: 68

Name Size Perms Modified Actions
611 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.10 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
2.96 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
28.63 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
6.40 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
16.58 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
2.38 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
5.92 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
8.48 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.39 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.30 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.39 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
4.31 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
15.56 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.02 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
2.77 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.21 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
5.55 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
704 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
562 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
842 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
7.23 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.28 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
480 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
7.39 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
413 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
6.73 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.14 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
490 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.53 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.40 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
12.68 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.61 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
4.10 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
743 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
5.66 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
6.51 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
562 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.32 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.43 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.02 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
392 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
9.80 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
18.54 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
626 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
606 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
2.67 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
2.44 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
206 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.42 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
9.21 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.62 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
4.15 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
5.85 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
47.94 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
937 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
336 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
937 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
580 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
5.51 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
605 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
3.42 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
2.04 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.13 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
898 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
1.68 KB lrw-r--r-- 2025-10-09 16:16:55
Edit Download
678 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download
740 B lrw-r--r-- 2025-10-09 16:16:55
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).