[Patches] [ python-Patches-707701 ] fix for #698517, Tkinter and tk8.4.2

SourceForge.net noreply@sourceforge.net
Thu, 27 Mar 2003 15:31:59 -0800


Patches item #707701, was opened at 2003-03-21 12:36
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=707701&group_id=5470

Category: Tkinter
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 7
Submitted By: Matthias Klose (doko)
Assigned to: Martin v. Löwis (loewis)
Summary: fix for #698517, Tkinter and tk8.4.2

Initial Comment:
[all python version, that can be built with tk8.4.2]

Fixing the failing conversions in _substitute. Use
try/except for each integer field, that is not
supported by all events.


----------------------------------------------------------------------

Comment By: Jeremy Moore (jmoore_calaway)
Date: 2003-03-27 16:31

Message:
Logged In: YES 
user_id=744000

(Apologies if this is the inappropriate place to ask)
I'm porting an app to Mac OS X 10.2 (begrudgingly) and ran straight into 
this bug. Nothing like changing versions of python (2.2.2 to 2.3a2) and 
tcl/tk (8.3.4 to 8.4.2) while using a platform you're unfamiliar with! 
Anyway, I have successflly applied the patch; however, it has simply 
propagated the problem elsewhere. Specifically, the pmw rev 1.1 
widgets library. The problem is, pmw does additional processing that 
chokes on the '??' now returned by the try: excempt: statements. 

Perhaps, if anyone knows, it would be better to mimick what tcl/tk 8.3.x 
returned with the except statements. Pmw may not be the only library 
out there that will get choked up on this.

I will submit a bug in the pmw for this as well, but I'm looking for a least 
resistance path to get things up and running. (And not really wanting to 
rewite all my GUI constructon code...)

Thanks

Jeremy Moore

----------------------------------------------------------------------

Comment By: Matthias Klose (doko)
Date: 2003-03-23 06:35

Message:
Logged In: YES 
user_id=60903

> What is the problem that this patch solves?

As the subject says: Provide a patch for #698517.

tk8.4.2 returns for the undefined fields in events empty
strings or '??' strings, on which the int conversions fail.


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-03-23 05:07

Message:
Logged In: YES 
user_id=21627

What is the problem that this patch solves?

----------------------------------------------------------------------

Comment By: Matthias Klose (doko)
Date: 2003-03-22 00:26

Message:
Logged In: YES 
user_id=60903

Attach alternate patch by Chad


----------------------------------------------------------------------

Comment By: Matthias Klose (doko)
Date: 2003-03-21 15:15

Message:
Logged In: YES 
user_id=60903

Attach alternate patch by Chad


----------------------------------------------------------------------

Comment By: Chad Netzer (chadn)
Date: 2003-03-21 15:10

Message:
Logged In: YES 
user_id=40145

Hmmm, you are right.  Your approach will be quicker, due to
local namespace function lookup speed (try/except is fast in
non-exception path).

But, then again, a lot more exception paths will be executed
with the new Tk (with "??" fields), anyway, so the speed
issues may not be that important.


----------------------------------------------------------------------

Comment By: Matthias Klose (doko)
Date: 2003-03-21 14:14

Message:
Logged In: YES 
user_id=60903

I thought the whole thing to define getint = int was to do
local lookups only. Therefore the inlined try/excepts


----------------------------------------------------------------------

Comment By: Chad Netzer (chadn)
Date: 2003-03-21 13:59

Message:
Logged In: YES 
user_id=40145

Would it be better to simply define getint() as:

def getint( s ):
    try:
        return int( s )
    except ValueError:
        return s

Rather than add lots of try/excepts in the codebase?
I'm attaching an example diff (btw - I kept your field
explanations in the code; I liked them there)

These patches are important, BTW, since 8.4.1 has a few bugs
that would require other patches to Tkinter (returning ""
for getboolean for example, which seems to be fixed)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=707701&group_id=5470