$NetBSD$ --- Modules/_cursesmodule.c.orig 2021-10-04 17:40:46.000000000 +0000 +++ Modules/_cursesmodule.c @@ -1226,8 +1226,8 @@ PyCursesWindow_ChgAt(PyCursesWindowObjec 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);