Skip to content

Commit 94ff109

Browse files
committed
Add declarations for private functions from pycore_modsupport
python/cpython#110964 Copied from pycore_modsupport.h remove PY_SSIZE_T_CLEAN definition python/cpython#104922
1 parent d3aa3c3 commit 94ff109

File tree

4 files changed

+62
-2
lines changed

4 files changed

+62
-2
lines changed

py313/_curses_panel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ static const char PyCursesVersion[] = "2.1";
1010

1111
/* Includes */
1212

13+
1314
#include "Python.h"
1415

1516
#include "py_curses.h"

py313/_cursesmodule.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ static const char PyCursesVersion[] = "2.2";
100100

101101
/* Includes */
102102

103-
#define PY_SSIZE_T_CLEAN
104-
105103
#include "Python.h"
106104

107105
/* This function declaration was moved from pycore_structseq.h file to adapt

py313/clinic/_curses_panel.c.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ preserve
66
# include "pycore_runtime.h" // _Py_SINGLETON()
77
#endif
88

9+
// Export for 'math' shared extension
10+
PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
11+
PyObject *const *args,
12+
Py_ssize_t nargs,
13+
PyObject *kwargs,
14+
PyObject *kwnames,
15+
struct _PyArg_Parser *parser,
16+
int minpos,
17+
int maxpos,
18+
int minkw,
19+
PyObject **buf);
20+
#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
21+
(((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
22+
(minpos) <= (nargs) && (nargs) <= (maxpos) && (args) != NULL) ? (args) : \
23+
_PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
24+
(minpos), (maxpos), (minkw), (buf)))
25+
26+
// Export for '_heapq' shared extension
27+
PyAPI_FUNC(void) _PyArg_BadArgument(
28+
const char *fname,
29+
const char *displayname,
30+
const char *expected,
31+
PyObject *arg);
932

1033
PyDoc_STRVAR(_curses_panel_panel_bottom__doc__,
1134
"bottom($self, /)\n"

py313/clinic/_cursesmodule.c.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,44 @@ preserve
77
# include "pycore_runtime.h" // _Py_ID()
88
#endif
99

10+
PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
11+
Py_ssize_t, Py_ssize_t);
12+
#define _Py_ANY_VARARGS(n) ((n) == PY_SSIZE_T_MAX)
13+
#define _PyArg_CheckPositional(funcname, nargs, min, max) \
14+
((!_Py_ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \
15+
|| _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
16+
17+
// Export for '_heapq' shared extension
18+
PyAPI_FUNC(void) _PyArg_BadArgument(
19+
const char *fname,
20+
const char *displayname,
21+
const char *expected,
22+
PyObject *arg);
23+
24+
// Export for '_curses' shared extension
25+
PyAPI_FUNC(int) _PyArg_ParseStack(
26+
PyObject *const *args,
27+
Py_ssize_t nargs,
28+
const char *format,
29+
...);
30+
31+
// Export for 'math' shared extension
32+
PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
33+
PyObject *const *args,
34+
Py_ssize_t nargs,
35+
PyObject *kwargs,
36+
PyObject *kwnames,
37+
struct _PyArg_Parser *parser,
38+
int minpos,
39+
int maxpos,
40+
int minkw,
41+
PyObject **buf);
42+
#define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
43+
(((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
44+
(minpos) <= (nargs) && (nargs) <= (maxpos) && (args) != NULL) ? (args) : \
45+
_PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
46+
(minpos), (maxpos), (minkw), (buf)))
47+
1048

1149
PyDoc_STRVAR(_curses_window_addch__doc__,
1250
"addch([y, x,] ch, [attr=_curses.A_NORMAL])\n"

0 commit comments

Comments
 (0)