File indexing completed on 2025-11-19 09:50:48
0001 #ifndef Py_INTERNAL_MODSUPPORT_H
0002 #define Py_INTERNAL_MODSUPPORT_H
0003
0004 #include "pycore_lock.h" // _PyOnceFlag
0005
0006 #ifdef __cplusplus
0007 extern "C" {
0008 #endif
0009
0010 #ifndef Py_BUILD_CORE
0011 # error "this header requires Py_BUILD_CORE define"
0012 #endif
0013
0014
0015 extern int _PyArg_NoKwnames(const char *funcname, PyObject *kwnames);
0016 #define _PyArg_NoKwnames(funcname, kwnames) \
0017 ((kwnames) == NULL || _PyArg_NoKwnames((funcname), (kwnames)))
0018
0019
0020 PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
0021 #define _PyArg_NoPositional(funcname, args) \
0022 ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
0023
0024
0025 PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
0026 #define _PyArg_NoKeywords(funcname, kwargs) \
0027 ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
0028
0029
0030 PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
0031 Py_ssize_t, Py_ssize_t);
0032 #define _Py_ANY_VARARGS(n) ((n) == PY_SSIZE_T_MAX)
0033 #define _PyArg_CheckPositional(funcname, nargs, min, max) \
0034 ((!_Py_ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \
0035 || _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
0036
0037 extern PyObject ** _Py_VaBuildStack(
0038 PyObject **small_stack,
0039 Py_ssize_t small_stack_len,
0040 const char *format,
0041 va_list va,
0042 Py_ssize_t *p_nargs);
0043
0044 extern PyObject* _PyModule_CreateInitialized(PyModuleDef*, int apiver);
0045
0046
0047 PyAPI_FUNC(int) _PyArg_ParseStack(
0048 PyObject *const *args,
0049 Py_ssize_t nargs,
0050 const char *format,
0051 ...);
0052
0053 extern int _PyArg_UnpackStack(
0054 PyObject *const *args,
0055 Py_ssize_t nargs,
0056 const char *name,
0057 Py_ssize_t min,
0058 Py_ssize_t max,
0059 ...);
0060
0061
0062 PyAPI_FUNC(void) _PyArg_BadArgument(
0063 const char *fname,
0064 const char *displayname,
0065 const char *expected,
0066 PyObject *arg);
0067
0068
0069
0070
0071 PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
0072 PyObject *const *args,
0073 Py_ssize_t nargs,
0074 PyObject *kwnames,
0075 struct _PyArg_Parser *,
0076 ...);
0077
0078
0079 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
0080 PyObject *const *args,
0081 Py_ssize_t nargs,
0082 PyObject *kwargs,
0083 PyObject *kwnames,
0084 struct _PyArg_Parser *parser,
0085 int minpos,
0086 int maxpos,
0087 int minkw,
0088 PyObject **buf);
0089 #define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
0090 (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
0091 (minpos) <= (nargs) && (nargs) <= (maxpos) && (args) != NULL) ? (args) : \
0092 _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
0093 (minpos), (maxpos), (minkw), (buf)))
0094
0095
0096 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywordsWithVararg(
0097 PyObject *const *args, Py_ssize_t nargs,
0098 PyObject *kwargs, PyObject *kwnames,
0099 struct _PyArg_Parser *parser,
0100 int minpos, int maxpos, int minkw,
0101 int vararg, PyObject **buf);
0102
0103 #ifdef __cplusplus
0104 }
0105 #endif
0106 #endif
0107