]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46000: Improve NetBSD curses compatibility (GH-29947)
authorThomas Klausner <tk@giga.or.at>
Fri, 10 Dec 2021 09:41:47 +0000 (10:41 +0100)
committerGitHub <noreply@github.com>
Fri, 10 Dec 2021 09:41:47 +0000 (11:41 +0200)
Misc/NEWS.d/next/Core and Builtins/2021-12-07-11-42-44.bpo-46000.v_ru3k.rst [new file with mode: 0644]
Modules/_cursesmodule.c

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 (file)
index 0000000..68e4bfa
--- /dev/null
@@ -0,0 +1 @@
+Improve compatibility of the :mod:`curses` module with NetBSD curses.
index 3770a032e977dc2b1b40bcbe27acdc7d01173720..7ebad692c2381dcd2e0a299196ffa850d641ba84 100644 (file)
@@ -1230,8 +1230,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);