Skip to content

Commit 5532d46

Browse files
committed
bpo-40207: Expose NCURSES_EXT_FUNCS and only run selected tests under it
1 parent dff92bb commit 5532d46

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

Doc/library/curses.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,11 @@ The :mod:`curses` module defines the following data members:
13191319
:const:`OK` upon success.
13201320

13211321

1322+
.. data:: NCURSES_EXT_FUNCS
1323+
1324+
An integer object representing the current version of the ncurses extensions.
1325+
1326+
13221327
.. data:: version
13231328

13241329
A bytes object representing the current version of the module. Also available as

Doc/whatsnew/3.9.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ Add :func:`curses.get_escdelay`, :func:`curses.set_escdelay`,
318318
:func:`curses.get_tabsize`, and :func:`curses.set_tabsize` functions.
319319
(Contributed by Anthony Sottile in :issue:`38312`.)
320320

321+
Add :data:`~curses.NCURSES_EXT_FUNCS` constant.
322+
(Contributed by Batuhan Taskaya in :issue:`40207`)
323+
321324
datetime
322325
--------
323326
The :meth:`~datetime.date.isocalendar()` of :class:`datetime.date`

Lib/test/test_curses.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,12 @@ def test_module_funcs(self):
261261
curses.putp(b'abc')
262262
curses.qiflush()
263263
curses.raw() ; curses.raw(1)
264-
curses.set_escdelay(25)
265-
self.assertEqual(curses.get_escdelay(), 25)
266-
curses.set_tabsize(4)
267-
self.assertEqual(curses.get_tabsize(), 4)
264+
if getattr(curses, "set_escdelay"):
265+
curses.set_escdelay(25)
266+
self.assertEqual(curses.get_escdelay(), 25)
267+
if getattr(curses, "set_tabsize"):
268+
curses.set_tabsize(4)
269+
self.assertEqual(curses.get_tabsize(), 4)
268270
if hasattr(curses, 'setsyx'):
269271
curses.setsyx(5,5)
270272
curses.tigetflag('hc')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Expose ``NCURSES_EXT_FUNCS`` under :mod:`curses`. Patch by Batuhan Taskaya.

Modules/_cursesmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,6 +4617,9 @@ PyInit__curses(void)
46174617
PyErr_Clear();
46184618
}
46194619
#endif /* NCURSES_VERSION */
4620+
#ifdef NCURSES_EXT_FUNCS
4621+
SetDictInt("NCURSES_EXT_FUNCS", NCURSES_EXT_FUNCS);
4622+
#endif
46204623

46214624
SetDictInt("ERR", ERR);
46224625
SetDictInt("OK", OK);

0 commit comments

Comments
 (0)