Debian Codegraph @

Include/internal/pycore_modsupport.h

raw
1 #ifndef Py_INTERNAL_MODSUPPORT_H
2 #define Py_INTERNAL_MODSUPPORT_H
3
4 #include "pycore_lock.h" // _PyOnceFlag
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 #ifndef Py_BUILD_CORE
11 # error "this header requires Py_BUILD_CORE define"
12 #endif
13
14
15 extern int _PyArg_NoKwnames(const char *funcname, PyObject *kwnames);
16 #define _PyArg_NoKwnames(funcname, kwnames) \
17 ((kwnames) == NULL || _PyArg_NoKwnames((funcname), (kwnames)))
18
19 // Export for '_bz2' shared extension
20 PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
21 #define _PyArg_NoPositional(funcname, args) \
22 ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
23
24 // Export for '_asyncio' shared extension
25 PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
26 #define _PyArg_NoKeywords(funcname, kwargs) \
27 ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
28
29 // Export for 'zlib' shared extension
30 PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
31 Py_ssize_t, Py_ssize_t);
32 #define _Py_ANY_VARARGS(n) ((n) == PY_SSIZE_T_MAX)
33 #define _PyArg_CheckPositional(funcname, nargs, min, max) \
34 ((!_Py_ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \
35 || _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
36
37 extern PyObject ** _Py_VaBuildStack(
38 PyObject **small_stack,
39 Py_ssize_t small_stack_len,
40 const char *format,
41 va_list va,
42 Py_ssize_t *p_nargs);
43
44 extern PyObject* _PyModule_CreateInitialized(PyModuleDef*, int apiver);
45
46 // Export for '_curses' shared extension
47 PyAPI_FUNC(int) _PyArg_ParseStack(
48 PyObject *const *args,
49 Py_ssize_t nargs,
50 const char *format,
51 ...);
52
53 extern int _PyArg_UnpackStack(
54 PyObject *const *args,
55 Py_ssize_t nargs,
56 const char *name,
57 Py_ssize_t min,
58 Py_ssize_t max,
59 ...);
60
61 // Export for '_heapq' shared extension
62 PyAPI_FUNC(void) _PyArg_BadArgument(
63 const char *fname,
64 const char *displayname,
65 const char *expected,
66 PyObject *arg);
67
68 // --- _PyArg_Parser API ---------------------------------------------------
69
70 // Export for '_dbm' shared extension
71 PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
72 PyObject *const *args,
73 Py_ssize_t nargs,
74 PyObject *kwnames,
75 struct _PyArg_Parser *,
76 ...);
77
78 // Export for 'math' shared extension
79 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
80 PyObject *const *args,
81 Py_ssize_t nargs,
82 PyObject *kwargs,
83 PyObject *kwnames,
84 struct _PyArg_Parser *parser,
85 int minpos,
86 int maxpos,
87 int minkw,
88 PyObject **buf);
89 #define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
90 (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
91 (minpos) <= (nargs) && (nargs) <= (maxpos) && (args) != NULL) ? (args) : \
92 _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
93 (minpos), (maxpos), (minkw), (buf)))
94
95 // Export for '_testclinic' shared extension
96 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywordsWithVararg(
97 PyObject *const *args, Py_ssize_t nargs,
98 PyObject *kwargs, PyObject *kwnames,
99 struct _PyArg_Parser *parser,
100 int minpos, int maxpos, int minkw,
101 int vararg, PyObject **buf);
102
103 #ifdef __cplusplus
104 }
105 #endif
106 #endif // !Py_INTERNAL_MODSUPPORT_H
107