Merge heads
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index f5c6608..d8fcf0f 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -79,7 +79,7 @@
Example of an LRU cache for static web content::
- @lru_cache(maxsize=20)
+ @lru_cache(maxsize=32)
def get_pep(num):
'Retrieve text of a Python Enhancement Proposal'
resource = 'http://www.python.org/dev/peps/pep-%04d/' % num
@@ -93,8 +93,8 @@
... pep = get_pep(n)
... print(n, len(pep))
- >>> print(get_pep.cache_info())
- CacheInfo(hits=3, misses=8, maxsize=20, currsize=8)
+ >>> get_pep.cache_info()
+ CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)
Example of efficiently computing
`Fibonacci numbers <http://en.wikipedia.org/wiki/Fibonacci_number>`_
@@ -108,10 +108,10 @@
return n
return fib(n-1) + fib(n-2)
- >>> print([fib(n) for n in range(16)])
+ >>> [fib(n) for n in range(16)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]
- >>> print(fib.cache_info())
+ >>> fib.cache_info()
CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)
.. versionadded:: 3.2
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 3397415..810f588 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -1433,6 +1433,7 @@
def tabify_region_event(self, event):
head, tail, chars, lines = self.get_region()
tabwidth = self._asktabwidth()
+ if tabwidth is None: return
for pos in range(len(lines)):
line = lines[pos]
if line:
@@ -1444,6 +1445,7 @@
def untabify_region_event(self, event):
head, tail, chars, lines = self.get_region()
tabwidth = self._asktabwidth()
+ if tabwidth is None: return
for pos in range(len(lines)):
lines[pos] = lines[pos].expandtabs(tabwidth)
self.set_region(head, tail, chars, lines)
@@ -1537,7 +1539,7 @@
parent=self.text,
initialvalue=self.indentwidth,
minvalue=2,
- maxvalue=16) or self.tabwidth
+ maxvalue=16)
# Guess indentwidth from text content.
# Return guessed indentwidth. This should not be believed unless
diff --git a/Misc/NEWS b/Misc/NEWS
index ad86c40..18a7834 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,17 @@
- Issue #17572: Avoid chained exceptions while passing bad directives to
time.strptime(). Initial patch by Claudiu Popa.
+- Issue #17435: threading.Timer's __init__ method no longer uses mutable
+ default values for the args and kwargs parameters.
+
+- Issue #17526: fix an IndexError raised while passing code without filename to
+ inspect.findsource(). Initial patch by Tyler Doyle.
+
+IDLE
+----
+
+- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box.
+
- Issue #17625: In IDLE, close the replace dialog after it is used.
- Issue #14254: IDLE now handles readline correctly across shell restarts.
@@ -37,12 +48,6 @@
- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.
-- Issue #17435: threading.Timer's __init__ method no longer uses mutable
- default values for the args and kwargs parameters.
-
-- Issue #17526: fix an IndexError raised while passing code without filename to
- inspect.findsource(). Initial patch by Tyler Doyle.
-
Documentation
-------------
diff --git a/Python/compile.c b/Python/compile.c
index 3cf71ef..0a8f58e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -248,8 +248,11 @@
}
plen -= ipriv;
- assert(1 <= PY_SSIZE_T_MAX - nlen);
- assert(1 + nlen <= PY_SSIZE_T_MAX - plen);
+ if (plen + nlen >= PY_SSIZE_T_MAX - 1) {
+ PyErr_SetString(PyExc_OverflowError,
+ "private identifier too large to be mangled");
+ return NULL;
+ }
maxchar = PyUnicode_MAX_CHAR_VALUE(ident);
if (PyUnicode_MAX_CHAR_VALUE(privateobj) > maxchar)