Skip to content

Commit 81528d2

Browse files
committed
Remove unused headers
1 parent 9ff7144 commit 81528d2

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

py313/_cursesmodule.c

+24-7
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,13 @@ static const char PyCursesVersion[] = "2.2";
105105
#endif
106106

107107
#include "Python.h"
108-
#include "pycore_long.h" // _PyLong_GetZero()
109-
#include "pycore_structseq.h" // _PyStructSequence_NewType()
108+
109+
/* This function declaration was moved from pycore_structseq.h file to adapt
110+
it for windows-curses package */
111+
PyAPI_FUNC(int) _PyStructSequence_InitType(
112+
PyTypeObject *type,
113+
PyStructSequence_Desc *desc,
114+
unsigned long tp_flags);
110115

111116
#ifdef __hpux
112117
#define STRICT_SYSV_CURSES
@@ -1116,9 +1121,9 @@ _curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
11161121
_curses.window.box
11171122
11181123
[
1119-
verch: object(c_default="_PyLong_GetZero()") = 0
1124+
verch: object(c_default="PyLong_FromLong(0)") = 0
11201125
Left and right side.
1121-
horch: object(c_default="_PyLong_GetZero()") = 0
1126+
horch: object(c_default="PyLong_FromLong(0)") = 0
11221127
Top and bottom side.
11231128
]
11241129
/
@@ -1132,7 +1137,7 @@ horch. The default corner characters are always used by this function.
11321137
static PyObject *
11331138
_curses_window_box_impl(PyCursesWindowObject *self, int group_right_1,
11341139
PyObject *verch, PyObject *horch)
1135-
/*[clinic end generated code: output=f3fcb038bb287192 input=f00435f9c8c98f60]*/
1140+
/*[clinic end generated code: output=f3fcb038bb287192 input=07797b056d82f6ab]*/
11361141
{
11371142
chtype ch1 = 0, ch2 = 0;
11381143
if (group_right_1) {
@@ -1415,6 +1420,12 @@ _curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
14151420
else {
14161421
rtn = mvwgetch(self->win, y, x);
14171422
}
1423+
1424+
// windows-curses hack to make resizing work the same as in ncurses. See
1425+
// PDCurses' documentation for resize_term().
1426+
if (rtn == KEY_RESIZE)
1427+
resize_term(0, 0);
1428+
14181429
Py_END_ALLOW_THREADS
14191430

14201431
return rtn;
@@ -1452,6 +1463,12 @@ _curses_window_getkey_impl(PyCursesWindowObject *self, int group_right_1,
14521463
else {
14531464
rtn = mvwgetch(self->win, y, x);
14541465
}
1466+
1467+
// windows-curses hack to make resizing work the same as in ncurses. See
1468+
// PDCurses' documentation for resize_term().
1469+
if (rtn == KEY_RESIZE)
1470+
resize_term(0, 0);
1471+
14551472
Py_END_ALLOW_THREADS
14561473

14571474
if (rtn == ERR) {
@@ -1519,13 +1536,13 @@ _curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
15191536
PyErr_SetString(PyCursesError, "no input");
15201537
return NULL;
15211538
}
1522-
if (ct == KEY_CODE_YES){
1539+
if (ct == KEY_CODE_YES) {
15231540
// windows-curses hack to make resizing work the same as in ncurses. See
15241541
// PDCurses' documentation for resize_term().
15251542
if (rtn == KEY_RESIZE)
15261543
resize_term(0, 0);
15271544

1528-
return PyLong_FromLong(rtn);
1545+
return PyLong_FromLong(rtn);
15291546
}
15301547
else
15311548
return PyUnicode_FromOrdinal(rtn);

py313/clinic/_cursesmodule.c.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ _curses_window_box(PyCursesWindowObject *self, PyObject *args)
515515
{
516516
PyObject *return_value = NULL;
517517
int group_right_1 = 0;
518-
PyObject *verch = _PyLong_GetZero();
519-
PyObject *horch = _PyLong_GetZero();
518+
PyObject *verch = PyLong_FromLong(0);
519+
PyObject *horch = PyLong_FromLong(0);
520520

521521
switch (PyTuple_GET_SIZE(args)) {
522522
case 0:
@@ -4318,4 +4318,4 @@ _curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored
43184318
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
43194319
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF
43204320
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
4321-
/*[clinic end generated code: output=96887782374f070a input=a9049054013a1b77]*/
4321+
/*[clinic end generated code: output=210f8665ff6c6d3b input=a9049054013a1b77]*/

0 commit comments

Comments
 (0)