[Python-checkins] bpo-46000: Improve NetBSD curses compatibility (GH-29947) (GH-30023)

serhiy-storchaka webhook-mailer at python.org
Fri Dec 10 06:21:24 EST 2021


https://github.com/python/cpython/commit/040f9f9c48f4e74e851d850275aa9e050a04d0c6
commit: 040f9f9c48f4e74e851d850275aa9e050a04d0c6
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2021-12-10T13:21:19+02:00
summary:

bpo-46000: Improve NetBSD curses compatibility (GH-29947) (GH-30023)

(cherry picked from commit 2fb797e93c6bbd44dfcbe23f63acfa240a87e48a)

Co-authored-by: Thomas Klausner <tk at giga.or.at>

files:
A Misc/NEWS.d/next/Core and Builtins/2021-12-07-11-42-44.bpo-46000.v_ru3k.rst
M 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
index 0000000000000..68e4bfa9e77b1
--- /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 a32cc4b88435c..f95677cee5750 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1077,8 +1077,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);



More information about the Python-checkins mailing list