Message79459
Split this from issue 1581476 as suggested
by Guilherme Polo (gpolo).
>Matthias: your issue about the pattern should be placed in a
>different
>issue.
Quote of my original report:
(This is about the search function of the Text class in Tkinter.
An IndexError is raised when pattern == '')
...
>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('--')
A further remark from Guilherme Polo (gpolo):
>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.
I do not understand that remark. Is it to avoid the TclError?
Or because the exception changes (IndexError -> TclError)?
What do you want to do when pattern == None? Raise ValueError
or IndexError (as before)?
Appended slightly simplified demo program from issue 1581476
and a patch against trunk r68445.
Cheers,
Matthias Kievernagel
mkiever/at/web/dot/de |
|
Date |
User |
Action |
Args |
2009-01-09 10:23:49 | mkiever | set | recipients:
+ mkiever |
2009-01-09 10:23:49 | mkiever | set | messageid: <1231496629.01.0.458062958908.issue4890@psf.upfronthosting.co.za> |
2009-01-09 10:23:37 | mkiever | link | issue4890 messages |
2009-01-09 10:23:36 | mkiever | create | |
|