#2 Use correct python C-API value type for SingleRadioButton value
Closed 3 years ago by terop. Opened 3 years ago by terop.
terop/newt radiobutton  into  master

file modified
+4
@@ -1096,7 +1096,11 @@ 

  {

  	snackWidget *w = (snackWidget *)self;

  

+ #if SIZEOF_VOID_P <= SIZEOF_LONG

  	return Py_BuildValue("i", newtRadioGetCurrent(w->co));

+ #else

+ 	return Py_BuildValue("L", newtRadioGetCurrent(w->co));

+ #endif

  }

  

  static void widgetDestructor(PyObject * o) {

The commit 7cdac0c broke SingleRadioButton select() method on 64 bit
machines. The widget_get_radioValue() returns 32bit integer while it
is compared to 64 bit key.

Use correct python C-API value type for SingleRadioButton value
in 64 bit build

closes #1

Thanks for the report and patch. On what platform do you see this?

I think the fix should change also the case when sizeof (void *) <= sizeof (long) to use "l" and cast the pointer, similarly to the commit 7cdac0c.

Pull-Request has been closed by terop

3 years ago

Architecture is 64 bit intel, the Linux distro is Debian. But my change did not fix the issue after all, downgrading to 0.52.17 version helps.

Can you please try changing the first return in the function to return Py_BuildValue("l", (long)newtRadioGetCurrent(w->co)); ?

Metadata