Skip to content

Commit c932bd8

Browse files
committed
Merge remote-tracking branch 'upstream/main' into testcapi-monitoring
2 parents 377e824 + 1812162 commit c932bd8

28 files changed

Lines changed: 1853 additions & 1347 deletions

Doc/library/curses.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,37 @@ The module :mod:`!curses` defines the following functions:
345345
a key with that value.
346346

347347

348+
.. function:: define_key(definition, keycode)
349+
350+
Define an escape sequence *definition*, a string, as a key that generates
351+
the key code *keycode*, so that :mod:`curses` interprets it like one of the
352+
keys predefined in the terminal database.
353+
354+
If *definition* is ``None``, any existing binding for *keycode* is removed.
355+
If *keycode* is zero or negative, any existing binding for *definition* is
356+
removed.
357+
358+
.. versionadded:: next
359+
360+
361+
.. function:: key_defined(definition)
362+
363+
Return the key code bound to the escape sequence *definition*, a string,
364+
``0`` if no key code is bound to it, or ``-1`` if *definition* is a prefix
365+
of a longer bound sequence (and so is ambiguous).
366+
367+
.. versionadded:: next
368+
369+
370+
.. function:: keyok(keycode, enable)
371+
372+
Enable (if *enable* is true) or disable (otherwise) interpretation of the
373+
key code *keycode*. Unlike :meth:`window.keypad`, this affects a single
374+
key code rather than all of them.
375+
376+
.. versionadded:: next
377+
378+
348379
.. function:: halfdelay(tenths)
349380

350381
Used for half-delay mode, which is similar to cbreak mode in that characters

Doc/whatsnew/3.16.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ curses
165165
:func:`~curses.scr_set`, which dump the whole screen to a file and restore it.
166166
(Contributed by Serhiy Storchaka in :gh:`152260`.)
167167

168+
* Add the :mod:`curses` key-management functions :func:`~curses.define_key`,
169+
:func:`~curses.key_defined` and :func:`~curses.keyok`, available when built
170+
against an ncurses with ``NCURSES_EXT_FUNCS``.
171+
(Contributed by Serhiy Storchaka in :gh:`152334`.)
172+
168173
gzip
169174
----
170175

Include/internal/pycore_dict.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ typedef struct {
9090
} PyDictUnicodeEntry;
9191

9292
extern PyDictKeysObject *_PyDict_NewKeysForClass(PyHeapTypeObject *);
93-
extern void _PyDict_RemoveKeysForClass(PyHeapTypeObject *);
94-
extern void _PyDict_SplitKeysInvalidated(PyDictKeysObject* keys);
9593
extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
9694

9795
/* Implementations of the `|` and `|=` operators for dict, used by the
@@ -241,17 +239,6 @@ struct _dictkeysobject {
241239
see the DK_ENTRIES() / DK_UNICODE_ENTRIES() functions below */
242240
};
243241

244-
struct _instancekeysobject {
245-
PyTypeObject* dsk_owning_type;
246-
struct _dictkeysobject dsk_keys;
247-
};
248-
249-
static inline struct _instancekeysobject *_PyDictKeys_AsSharedKeys(struct _dictkeysobject *keys)
250-
{
251-
assert(keys->dk_kind == DICT_KEYS_SPLIT);
252-
return _Py_CONTAINER_OF(keys, struct _instancekeysobject, dsk_keys);
253-
}
254-
255242
/* This must be no more than 250, for the prefix size to fit in one byte. */
256243
#define SHARED_KEYS_MAX_SIZE 30
257244
#define NEXT_LOG2_SHARED_KEYS_MAX_SIZE 6

Include/internal/pycore_opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)