summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-12-10 10:29:23 (GMT)
committerGitHub <noreply@github.com>2021-12-10 10:29:23 (GMT)
commitbb76410824e526ee075eac22812a577cca7583cf (patch)
tree09cb395f9145d0efad8f49d03dcc5a66162b2a90
parent64c2788f42c49c7094d3b6e5404fe8386a2b4779 (diff)
downloadcpython-bb76410824e526ee075eac22812a577cca7583cf.zip
cpython-bb76410824e526ee075eac22812a577cca7583cf.tar.gz
cpython-bb76410824e526ee075eac22812a577cca7583cf.tar.bz2
bpo-46000: Improve NetBSD curses compatibility (GH-29947)
(cherry picked from commit 2fb797e93c6bbd44dfcbe23f63acfa240a87e48a) Co-authored-by: Thomas Klausner <tk@giga.or.at>
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2021-12-07-11-42-44.bpo-46000.v_ru3k.rst1
-rw-r--r--Modules/_cursesmodule.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-12-07-11-42-44.bpo-46000.v_ru3k.rst b/Misc/NEWS.d/next/Core and Builtins/2021-12-07-11-42-44.bpo-46000.v_ru3k.rst
new file mode 100644
index 0000000..68e4bfa
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2021-12-07-11-42-44.bpo-46000.v_ru3k.rst
@@ -0,0 +1 @@
+Improve compatibility of the :mod:`curses` module with NetBSD curses.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 511073f..a1de435 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1226,8 +1226,8 @@ PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
return NULL;
}
- color = (short)((attr >> 8) & 0xff);
- attr = attr - (color << 8);
+ color = (short) PAIR_NUMBER(attr);
+ attr = attr & A_ATTRIBUTES;
if (use_xy) {
rtn = mvwchgat(self->win,y,x,num,attr,color,NULL);