[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread Hans Bering

Hans Bering  added the comment:

Sorry for the misclassification, and thanks for correcting that.

I agree, this issue is most likely related to issue 10647; but at some level I 
think they must be different, because issue 10647 seems to be specific to 
Python 3.1 under Windows; I could not reproduce that issue neither under Ubuntu 
nor with Python 3.2 in Windows. This behaviour on the other hand I could 
reproduce with Python 2.7 and Python 3.2 in both Ubuntu and Windows. The 
underlying problem in both cases, I believe, is similar: That int/float 
arguments are somewhere turned into locale-dependent string representations and 
later parsed back using a potentially different locale.

Which brings me to why I consider this to be a bug - sorry for not having made 
that point clearer: The handling of the float argument depends on the system 
locale. If you change the example script to run with an English locale, you do 
not get an error; instead, the float is implicitly used as an int, and 
everything is fine. Only if you use German or a similar locale, will the float 
trigger an error. So the behaviour is at the very least inconsistent. If 
treating a float argument as an error is deemed acceptable, then this error 
should not be locale-dependent.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

Why is this a bug ? You passed something that is not supposed to work with tk 
and tk said so.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread R. David Murray

Changes by R. David Murray :


--
superseder: scrollbar crash in non-US locale format settings -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +gpolo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread R. David Murray

R. David Murray  added the comment:

FYI 'crash' is for segfault.  A traceback is "just a bug" :)

I'm not sure that this it is worth having this as a separate bug from #10647, 
but I'll let someone with tk knowledge decide that.

--
nosy: +kbk, r.david.murray, terry.reedy
superseder:  -> scrollbar crash in non-US locale format settings
type: crash -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread Hans Bering

New submission from Hans Bering :

The attached script will crash on a current Ubuntu with Python 3.2 + tcl/tk 
when using a locale which uses a comma as a decimal separator (e.g., German). 
It will not crash when using a locale which uses a dot as the decimal separator 
(e.g., English). In case of the crash, the output and stacktrace are as follows:

locale = ('de_DE', 'UTF8')
Traceback (most recent call last):
  File "tkinterCrash.py", line 20, in 
tkcanvas = Canvas(master=master, width=w, height=2, borderwidth=4)
  File "/usr/lib/python3.2/tkinter/__init__.py", line 2101, in __init__
Widget.__init__(self, master, 'canvas', cnf, kw)
  File "/usr/lib/python3.2/tkinter/__init__.py", line 1961, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: bad screen distance "10.0"

Originally, we stumbled over this problem when using matplotlib, which 
passes/passed down float types as width arguments on occasions. It has been 
fixed there since (see https://github.com/matplotlib/matplotlib/pull/387).

The locale dependency can make this problem difficult to debug when it occurs. 
In our setup, we had a program work on one machine, but it crashed on the next 
machine, which we believed to have an identical setup; it took us a day to 
figure out what the difference was. We would expect the constructor to either 
always work with float arguments, or to always reject them, regardless of 
locale.

We have been able to reproduce this issue both with Python 2.7.2 and Python 
3.2, both under a current Ubuntu and Windows 7.

--
components: Tkinter
files: badScreenSizeTk.py
messages: 140338
nosy: hans.bering
priority: normal
severity: normal
status: open
title: Locale-dependent crash for float width argument to Tkinter widget 
constructor
type: crash
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file22653/badScreenSizeTk.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com