1 #ifndef Py_CPYTHON_MODSUPPORT_H
2 #  error "this header file must not be included directly"
3 #endif
4 
5 /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
6    to mean Py_ssize_t */
7 #ifdef PY_SSIZE_T_CLEAN
8 #define _Py_VaBuildStack                _Py_VaBuildStack_SizeT
9 #else
10 PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
11 PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT(
12     PyObject **small_stack,
13     Py_ssize_t small_stack_len,
14     const char *format,
15     va_list va,
16     Py_ssize_t *p_nargs);
17 #endif
18 
19 PyAPI_FUNC(int) _PyArg_UnpackStack(
20     PyObject *const *args,
21     Py_ssize_t nargs,
22     const char *name,
23     Py_ssize_t min,
24     Py_ssize_t max,
25     ...);
26 
27 PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
28 PyAPI_FUNC(int) _PyArg_NoKwnames(const char *funcname, PyObject *kwnames);
29 PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
30 #define _PyArg_NoKeywords(funcname, kwargs) \
31     ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
32 #define _PyArg_NoKwnames(funcname, kwnames) \
33     ((kwnames) == NULL || _PyArg_NoKwnames((funcname), (kwnames)))
34 #define _PyArg_NoPositional(funcname, args) \
35     ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
36 
37 PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *);
38 PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
39                                        Py_ssize_t, Py_ssize_t);
40 #define _PyArg_CheckPositional(funcname, nargs, min, max) \
41     ((!ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \
42      || _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
43 
44 PyAPI_FUNC(PyObject **) _Py_VaBuildStack(
45     PyObject **small_stack,
46     Py_ssize_t small_stack_len,
47     const char *format,
48     va_list va,
49     Py_ssize_t *p_nargs);
50 
51 typedef struct _PyArg_Parser {
52     const char *format;
53     const char * const *keywords;
54     const char *fname;
55     const char *custom_msg;
56     int pos;            /* number of positional-only arguments */
57     int min;            /* minimal number of arguments */
58     int max;            /* maximal number of positional arguments */
59     PyObject *kwtuple;  /* tuple of keyword parameter names */
60     struct _PyArg_Parser *next;
61 } _PyArg_Parser;
62 
63 #ifdef PY_SSIZE_T_CLEAN
64 #define _PyArg_ParseTupleAndKeywordsFast  _PyArg_ParseTupleAndKeywordsFast_SizeT
65 #define _PyArg_ParseStack  _PyArg_ParseStack_SizeT
66 #define _PyArg_ParseStackAndKeywords  _PyArg_ParseStackAndKeywords_SizeT
67 #define _PyArg_VaParseTupleAndKeywordsFast  _PyArg_VaParseTupleAndKeywordsFast_SizeT
68 #endif
69 
70 PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
71                                                  struct _PyArg_Parser *, ...);
72 PyAPI_FUNC(int) _PyArg_ParseStack(
73     PyObject *const *args,
74     Py_ssize_t nargs,
75     const char *format,
76     ...);
77 PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
78     PyObject *const *args,
79     Py_ssize_t nargs,
80     PyObject *kwnames,
81     struct _PyArg_Parser *,
82     ...);
83 PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
84                                                    struct _PyArg_Parser *, va_list);
85 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
86         PyObject *const *args, Py_ssize_t nargs,
87         PyObject *kwargs, PyObject *kwnames,
88         struct _PyArg_Parser *parser,
89         int minpos, int maxpos, int minkw,
90         PyObject **buf);
91 
92 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywordsWithVararg(
93         PyObject *const *args, Py_ssize_t nargs,
94         PyObject *kwargs, PyObject *kwnames,
95         struct _PyArg_Parser *parser,
96         int minpos, int maxpos, int minkw,
97         int vararg, PyObject **buf);
98 
99 #define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
100     (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
101       (minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
102      _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
103                            (minpos), (maxpos), (minkw), (buf)))
104 
105 PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(PyModuleDef*, int apiver);
106 
107 PyAPI_DATA(const char *) _Py_PackageContext;
108