This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mkiever
Recipients mkiever
Date 2009-01-09.10:23:34
SpamBayes Score 0.03019435
Marked as misclassified No
Message-id <1231496629.01.0.458062958908.issue4890@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2009-01-09 10:23:49mkieversetrecipients: + mkiever
2009-01-09 10:23:49mkieversetmessageid: <1231496629.01.0.458062958908.issue4890@psf.upfronthosting.co.za>
2009-01-09 10:23:37mkieverlinkissue4890 messages
2009-01-09 10:23:36mkievercreate