Automated merge with ssh://hg.python.org/cpython
diff --git a/Lib/heapq.py b/Lib/heapq.py
index 00b429c..d615239 100644
--- a/Lib/heapq.py
+++ b/Lib/heapq.py
@@ -358,6 +358,7 @@
'''
_heappop, _heapreplace, _StopIteration = heappop, heapreplace, StopIteration
+ _len = len
h = []
h_append = h.append
@@ -369,17 +370,20 @@
pass
heapify(h)
- while 1:
+ while _len(h) > 1:
try:
- while 1:
- v, itnum, next = s = h[0] # raises IndexError when h is empty
+ while True:
+ v, itnum, next = s = h[0]
yield v
s[0] = next() # raises StopIteration when exhausted
_heapreplace(h, s) # restore heap condition
except _StopIteration:
_heappop(h) # remove empty iterator
- except IndexError:
- return
+ if h:
+ # fast case when only a single iterator remains
+ v, itnum, next = h[0]
+ yield v
+ yield from next.__self__
# Extend the implementations of nsmallest and nlargest to use a key= argument
_nsmallest = nsmallest
diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py
index 929d358..f366030 100644
--- a/Lib/idlelib/AutoComplete.py
+++ b/Lib/idlelib/AutoComplete.py
@@ -160,12 +160,9 @@
if not comp_lists[0]:
return
self.autocompletewindow = self._make_autocomplete_window()
- self.autocompletewindow.show_window(comp_lists,
- "insert-%dc" % len(comp_start),
- complete,
- mode,
- userWantsWin)
- return True
+ return not self.autocompletewindow.show_window(
+ comp_lists, "insert-%dc" % len(comp_start),
+ complete, mode, userWantsWin)
def fetch_completions(self, what, mode):
"""Return a pair of lists of completions for something. The first list
diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py
index 7787e70..f666ea6 100644
--- a/Lib/idlelib/AutoCompleteWindow.py
+++ b/Lib/idlelib/AutoCompleteWindow.py
@@ -157,13 +157,14 @@
self.start = self.widget.get(self.startindex, "insert")
if complete:
completed = self._complete_string(self.start)
+ start = self.start
self._change_start(completed)
i = self._binary_search(completed)
if self.completions[i] == completed and \
(i == len(self.completions)-1 or
self.completions[i+1][:len(completed)] != completed):
# There is exactly one matching completion
- return
+ return completed == start
self.userwantswindow = userWantsWin
self.lasttypedstart = self.start
diff --git a/Misc/ACKS b/Misc/ACKS
index 030f980..9d0dc46 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -135,6 +135,7 @@
Matthew Boedicker
Robin Boerdijk
David Bolen
+Wouter Bolsterlee
Gawain Bolton
Forest Bond
Gregory Bond
diff --git a/Misc/NEWS b/Misc/NEWS
index 6f7ede3..23035d2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,11 @@
test.support was converted to a package. Regression noticed by Zachary
Ware.
+IDLE
+----
+
+- Issue #18988: The "Tab" key now works when a word is already autocompleted.
+
What's New in Python 3.4.0 Alpha 2?
===================================