summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilherme Polo <ggpolo@gmail.com>2009-02-09 16:41:09 (GMT)
committerGuilherme Polo <ggpolo@gmail.com>2009-02-09 16:41:09 (GMT)
commitd2ea0332abe72152c4447cdd3e41f3c201d8df74 (patch)
treecbe669f7830a9a34272fc4f7afa8a81488ef6a51
parent190c35f928f22ac46dfc219467965b18ee8eabe7 (diff)
downloadcpython-d2ea0332abe72152c4447cdd3e41f3c201d8df74.zip
cpython-d2ea0332abe72152c4447cdd3e41f3c201d8df74.tar.gz
cpython-d2ea0332abe72152c4447cdd3e41f3c201d8df74.tar.bz2
Fixed issue #4890: Handle empty text search pattern in
Tkinter.Text.search
-rw-r--r--Lib/lib-tk/Tkinter.py5
-rw-r--r--Misc/NEWS2
2 files changed, 5 insertions, 2 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 8a9d8a4..fded249 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -3032,7 +3032,8 @@ class Text(Widget):
forwards=None, backwards=None, exact=None,
regexp=None, nocase=None, count=None, elide=None):
"""Search PATTERN beginning from INDEX until STOPINDEX.
- Return the index of the first character of a match or an empty string."""
+ Return the index of the first character of a match or an
+ empty string."""
args = [self._w, 'search']
if forwards: args.append('-forwards')
if backwards: args.append('-backwards')
@@ -3041,7 +3042,7 @@ class Text(Widget):
if nocase: args.append('-nocase')
if elide: args.append('-elide')
if count: args.append('-count'); args.append(count)
- if pattern[0] == '-': args.append('--')
+ if pattern and pattern[0] == '-': args.append('--')
args.append(pattern)
args.append(index)
if stopindex: args.append(stopindex)
diff --git a/Misc/NEWS b/Misc/NEWS
index 9f56bb8..824b0d4 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -152,6 +152,8 @@ Core and Builtins
Library
-------
+- Issue #4890: Handle empty text search pattern in Tkinter.Text.search.
+
- Issue #5170: Fixed Unicode output bug in logging and added test case.
This is a regression which did not occur in 2.5.