Skip to content

Commit c5b0f68

Browse files
author
guilherme.polo
committed
Fixed issue #4890: Handle empty text search pattern in
Tkinter.Text.search git-svn-id: http://svn.python.org/projects/python/trunk@69461 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 914705a commit c5b0f68

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Lib/lib-tk/Tkinter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,7 +3032,8 @@ def search(self, pattern, index, stopindex=None,
30323032
forwards=None, backwards=None, exact=None,
30333033
regexp=None, nocase=None, count=None, elide=None):
30343034
"""Search PATTERN beginning from INDEX until STOPINDEX.
3035-
Return the index of the first character of a match or an empty string."""
3035+
Return the index of the first character of a match or an
3036+
empty string."""
30363037
args = [self._w, 'search']
30373038
if forwards: args.append('-forwards')
30383039
if backwards: args.append('-backwards')
@@ -3041,7 +3042,7 @@ def search(self, pattern, index, stopindex=None,
30413042
if nocase: args.append('-nocase')
30423043
if elide: args.append('-elide')
30433044
if count: args.append('-count'); args.append(count)
3044-
if pattern[0] == '-': args.append('--')
3045+
if pattern and pattern[0] == '-': args.append('--')
30453046
args.append(pattern)
30463047
args.append(index)
30473048
if stopindex: args.append(stopindex)

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ Core and Builtins
152152
Library
153153
-------
154154

155+
- Issue #4890: Handle empty text search pattern in Tkinter.Text.search.
156+
155157
- Issue #5170: Fixed Unicode output bug in logging and added test case.
156158
This is a regression which did not occur in 2.5.
157159

0 commit comments

Comments
 (0)