[New-bugs-announce] [issue27817] String variable misinterpreted as boolean

Andreas Bolsch report at bugs.python.org
Sat Aug 20 12:50:27 EDT 2016


New submission from Andreas Bolsch:

Applies to 2.7.10 and 2.7.12:

Installed LinuxCNC from source at https://github.com/LinuxCNC/linuxcnc :
./configure --with-realtime=uspace --enable-simulator --enable-non-distributable=yes --prefix=/usr --libdir=/usr/lib64
make
make install

Configured device as per attached files, that's a simulated XYZ-mill.

Now start application with: 
linuxcnc linuxcnc/configs/my-mill/my-mill.ini

The "Manual Control Widget" has a radio button denoted "X", "Y", "Z" with values "x", "y" and "z" to select the active axis. "X" and "Z" work as desired, but "Y" does not. Instead:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1537, in __call__
    return self.func(*args)
  File "/usr/bin/axis", line 2323, in jog_plus
    a = "xyzabcuvw".index(a)
ValueError: substring not found

Reason: The Tcl button variable "current_axis" gets "y" assigned to as desired. The corresponding python variable "a" however, gets "True". I've tracked that down to "FromObj" in "_tkinter.c" where "value->typePtr" equals "app->OldBooleanType". 

In 2.7.8 and 2.7.9 the behavior is ok, but in 2.7.10 and 2.7.12 button value "y" (and of course "yes", "no" etc.) is transformed into boolean a value ...    

This change of behaviour depends only on _tkinter.so, exchanging just *this single* file makes the problem (dis-) appear.

----------
components: Tkinter
messages: 273224
nosy: Andreas Bolsch
priority: normal
severity: normal
status: open
title: String variable misinterpreted as boolean
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27817>
_______________________________________


More information about the New-bugs-announce mailing list