Issue 1581476: Text search gives bad count if called from variable trace (original) (raw)

Issue1581476

Created on 2006-10-20 19:26 by reowen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
text search bug.py reowen,2006-10-20 19:26 Script to demonstrate the problem
issue_1581476.diff gpolo,2009-01-02 22:35
Messages (9)
msg30329 - (view) Author: Russell Owen (reowen) Date: 2006-10-20 19:26
If Text search is called from a variable trace then the count variable is not be updated. I see this with Python 2.4.3 and Aqua Tcl/Tk 8.4.11 on MacOS X 10.4.7. I have not tested it elsewhere. Note that this works fine in tcl/tk so this appears to be a Tkinter issue. To see the problem run the attached python script. (The script also includes the equivalent tcl/tk code in its comments, so you can easily test the issue directly in tcl/tk if desired.)
msg30330 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2007-01-19 20:50
Same behaviour on Linux and current Python trunk. In addition I get an IndexError, if I delete the last character of the search string. Does Tk allow calling search with an empty pattern? Tkinter could handle this (with a correct result) with the following change in Tkinter.py / Text.search(): if pattern[0] == '-': args.append('--') -> if pattern and pattern[0] == '-': args.append('--') Greetings, Matthias Kievernagel
msg76861 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-12-04 01:22
This is indeed a problem with Tkinter only, but I didn't check what is causing it yet. For the suggestion about fixing the search method regarding the pattern: the fix is almost fine, but we need to disallow None as a pattern.
msg76881 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2008-12-04 13:05
Nice to see someone working on this. One thing I've checked (iirc): You can set iVar in doSearch by hand like this: iVar.set(2) print 'iVar.get()', iVar.get() And iVar rests at this value. t.search does not change the value. I don't know anything about how the tcl-interpreter is embedded into python. I somehow had the impression there might be a _tkinter limitation there. Something like handling two callbacks into _tkinter at the same time or the tcl interpreter being unresponsive while calling a _tkinter function. At that point I gave up. Seen nothing obvious in _tkinter/Tkinter. Matthias Kievernagel (mkiever/at/web/dot/de)
msg78895 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-01-02 22:35
Fixed the issue now. _tkinter.call needs to use the TCL_EVAL_GLOBAL flag since all the variables in Tkinter are global variables. Matthias: your issue about the pattern should be placed in a different issue.
msg79460 - (view) Author: Matthias Kievernagel (mkiever) * Date: 2009-01-09 10:27
>Matthias: your issue about the pattern should be placed in a >different >issue. Done as Issue4890. Appended a simplified copy of the demo program and a patch there. I do not understand your remark about None though (see new issue). Cheers, Matthias Kievernagel mkiever/at/web/dot/de
msg80944 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-02-02 15:47
The patch looks fine, please apply. We should come up with a deprecation strategy for GlobalCall, though, since that function is now mostly redundant.
msg80980 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-02-02 18:40
Uhm, is it fine to remove it for good in 3.1 ? And then add a warning in 2.7 when it gets called which in turns just call Tkapp_Call ?
msg80999 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-02-02 21:26
Commited in r69217 (r69219), r69220, r69222, r69223 Martin, I will open another ticket about GlobalCall deprecation, later today.
History
Date User Action Args
2022-04-11 14:56:20 admin set github: 44153
2009-02-02 21:26:19 gpolo set status: open -> closedresolution: accepted -> fixedmessages: +
2009-02-02 18:40:27 gpolo set messages: +
2009-02-02 15:47:46 loewis set assignee: loewis -> gpolo
2009-02-02 15:47:37 loewis set resolution: acceptedmessages: +
2009-01-09 10:27:54 mkiever set messages: +
2009-01-02 22:35:31 gpolo set files: + issue_1581476.diffkeywords: + patchmessages: + versions: + Python 2.6, Python 3.0, Python 3.1, Python 2.7, - Python 2.4
2008-12-04 13:05:58 mkiever set messages: +
2008-12-04 01:23:00 gpolo set messages: +
2008-09-15 17:39:27 gpolo set nosy: + gpolo
2006-10-20 19:26:07 reowen create