mirror of
https://github.com/python/cpython.git
synced 2026-04-20 10:51:00 +00:00
Rename from _Py_INTERNAL_ABI_SLOT to _Py_ABI_SLOT and define the macro using _PyABIInfo_DEFAULT. Use the ABI slot in stdlib extension modules to enable running a check of ABI version compatibility. _tkinter, _tracemalloc and readline don't use the slots, hence they need explicit handling. Co-authored-by: Victor Stinner <vstinner@python.org>
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#ifndef Py_CPYTHON_MODSUPPORT_H
|
|
# error "this header file must not be included directly"
|
|
#endif
|
|
|
|
PyAPI_FUNC(int) PyArg_ParseArray(
|
|
PyObject *const *args,
|
|
Py_ssize_t nargs,
|
|
const char *format,
|
|
...);
|
|
PyAPI_FUNC(int) PyArg_ParseArrayAndKeywords(
|
|
PyObject *const *args,
|
|
Py_ssize_t nargs,
|
|
PyObject *kwnames,
|
|
const char *format,
|
|
const char * const *kwlist,
|
|
...);
|
|
|
|
// A data structure that can be used to run initialization code once in a
|
|
// thread-safe manner. The C++11 equivalent is std::call_once.
|
|
typedef struct {
|
|
uint8_t v;
|
|
} _PyOnceFlag;
|
|
|
|
typedef struct _PyArg_Parser {
|
|
const char *format;
|
|
const char * const *keywords;
|
|
const char *fname;
|
|
const char *custom_msg;
|
|
_PyOnceFlag once; /* atomic one-time initialization flag */
|
|
int is_kwtuple_owned; /* does this parser own the kwtuple object? */
|
|
int pos; /* number of positional-only arguments */
|
|
int min; /* minimal number of arguments */
|
|
int max; /* maximal number of positional arguments */
|
|
PyObject *kwtuple; /* tuple of keyword parameter names */
|
|
struct _PyArg_Parser *next;
|
|
} _PyArg_Parser;
|
|
|
|
PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
|
|
struct _PyArg_Parser *, ...);
|
|
|
|
#ifdef Py_BUILD_CORE
|
|
// For internal use in stdlib. Needs C99 compound literals.
|
|
// Defined here to avoid every stdlib module including pycore_modsupport.h
|
|
#define _Py_ABI_SLOT {Py_mod_abi, (void*) &(PyABIInfo) _PyABIInfo_DEFAULT}
|
|
#endif
|