merge 2.7.6 release branch
diff --git a/.hgtags b/.hgtags
index 1a8dd47..8925a8c 100644
--- a/.hgtags
+++ b/.hgtags
@@ -160,4 +160,5 @@
026ee0057e2d3305f90a9da41daf7c3f9eb1e814 v2.7.4
ab05e7dd27889b93f20d97bae86170aabfe45ace v2.7.5
a0025037f11a73df5a7dd03e5a4027adad4cb94e v2.6.9rc1
+fcb3ec2842f99454322492dd0ec2cf01322df093 v2.6.9
4913d0e9be30666218cc4d713937e81c0e7f346a v2.7.6rc1
diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
index 72711e1..642d25b 100644
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -380,7 +380,7 @@
is to be displayed.
-.. function:: newwin(begin_y, begin_x)
+.. function:: newwin(nlines, ncols)
newwin(nlines, ncols, begin_y, begin_x)
Return a new window, whose left-upper corner is at ``(begin_y, begin_x)``, and
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 0de7391..db95269 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -1720,7 +1720,7 @@
making assumptions about the output value. Field orderings will vary (for
example, "month/day/year" versus "day/month/year"), and the output may
contain Unicode characters encoded using the locale's default encoding (for
- example, if the current locale is ``js_JP``, the default encoding could be
+ example, if the current locale is ``ja_JP``, the default encoding could be
any one of ``eucJP``, ``SJIS``, or ``utf-8``; use :meth:`locale.getlocale`
to determine the current locale's encoding).
diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst
index f87c2eb..92180d6 100644
--- a/Doc/library/nntplib.rst
+++ b/Doc/library/nntplib.rst
@@ -234,25 +234,25 @@
.. method:: NNTP.next()
- Send a ``NEXT`` command. Return as for :meth:`stat`.
+ Send a ``NEXT`` command. Return as for :meth:`.stat`.
.. method:: NNTP.last()
- Send a ``LAST`` command. Return as for :meth:`stat`.
+ Send a ``LAST`` command. Return as for :meth:`.stat`.
.. method:: NNTP.head(id)
- Send a ``HEAD`` command, where *id* has the same meaning as for :meth:`stat`.
+ Send a ``HEAD`` command, where *id* has the same meaning as for :meth:`.stat`.
Return a tuple ``(response, number, id, list)`` where the first three are the
- same as for :meth:`stat`, and *list* is a list of the article's headers (an
+ same as for :meth:`.stat`, and *list* is a list of the article's headers (an
uninterpreted list of lines, without trailing newlines).
.. method:: NNTP.body(id,[file])
- Send a ``BODY`` command, where *id* has the same meaning as for :meth:`stat`.
+ Send a ``BODY`` command, where *id* has the same meaning as for :meth:`.stat`.
If the *file* parameter is supplied, then the body is stored in a file. If
*file* is a string, then the method will open a file object with that name,
write to it then close it. If *file* is a file object, then it will start
@@ -263,7 +263,7 @@
.. method:: NNTP.article(id)
Send an ``ARTICLE`` command, where *id* has the same meaning as for
- :meth:`stat`. Return as for :meth:`head`.
+ :meth:`.stat`. Return as for :meth:`head`.
.. method:: NNTP.slave()
@@ -290,7 +290,7 @@
.. method:: NNTP.post(file)
Post an article using the ``POST`` command. The *file* argument is an open file
- object which is read until EOF using its :meth:`readline` method. It should be
+ object which is read until EOF using its :meth:`~file.readline` method. It should be
a well-formed news article, including the required headers. The :meth:`post`
method automatically escapes lines beginning with ``.``.
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 9d7bd5a..679cedb 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1936,6 +1936,10 @@
Note that some platforms including FreeBSD <= 6.3, Cygwin and OS/2 EMX have
known issues when using fork() from a thread.
+ .. warning::
+
+ See :mod:`ssl` for applications that use the SSL module with fork().
+
Availability: Unix.
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index 550c249..898e7d2 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -30,6 +30,14 @@
operating system socket APIs. The installed version of OpenSSL may also
cause variations in behavior.
+.. warning::
+
+ OpenSSL's internal random number generator does not properly handle fork.
+ Applications must change the PRNG state of the parent process if they use
+ any SSL feature with :func:`os.fork`. Any successful call of
+ :func:`~ssl.RAND_add`, :func:`~ssl.RAND_bytes` or
+ :func:`~ssl.RAND_pseudo_bytes` is sufficient.
+
This section documents the objects and functions in the ``ssl`` module; for more
general information about TLS, SSL, and certificates, the reader is referred to
the documents in the "See Also" section at the bottom.
diff --git a/Lib/heapq.py b/Lib/heapq.py
index 19037ab..4b2c0c4 100644
--- a/Lib/heapq.py
+++ b/Lib/heapq.py
@@ -380,7 +380,7 @@
while _len(h) > 1:
try:
- while True:
+ while 1:
v, itnum, next = s = h[0]
yield v
s[0] = next() # raises StopIteration when exhausted
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 4d18600..04531b9 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -169,7 +169,8 @@
self._task_handler = threading.Thread(
target=Pool._handle_tasks,
- args=(self._taskqueue, self._quick_put, self._outqueue, self._pool)
+ args=(self._taskqueue, self._quick_put, self._outqueue,
+ self._pool, self._cache)
)
self._task_handler.daemon = True
self._task_handler._state = RUN
@@ -329,7 +330,7 @@
debug('worker handler exiting')
@staticmethod
- def _handle_tasks(taskqueue, put, outqueue, pool):
+ def _handle_tasks(taskqueue, put, outqueue, pool, cache):
thread = threading.current_thread()
for taskseq, set_length in iter(taskqueue.get, None):
@@ -340,9 +341,12 @@
break
try:
put(task)
- except IOError:
- debug('could not put task on queue')
- break
+ except Exception as e:
+ job, ind = task[:2]
+ try:
+ cache[job]._set(ind, (False, e))
+ except KeyError:
+ pass
else:
if set_length:
debug('doing set_length()')
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index bd40705..471753e 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -276,10 +276,10 @@
# set is constructed. Then, this bitmap is sliced into chunks of 256
# characters, duplicate chunks are eliminated, and each chunk is
# given a number. In the compiled expression, the charset is
-# represented by a 16-bit word sequence, consisting of one word for
-# the number of different chunks, a sequence of 256 bytes (128 words)
+# represented by a 32-bit word sequence, consisting of one word for
+# the number of different chunks, a sequence of 256 bytes (64 words)
# of chunk numbers indexed by their original chunk position, and a
-# sequence of chunks (16 words each).
+# sequence of 256-bit chunks (8 words each).
# Compression is normally good: in a typical charset, large ranges of
# Unicode will be either completely excluded (e.g. if only cyrillic
@@ -294,7 +294,7 @@
# In UCS-4 mode, the BIGCHARSET opcode still supports only subsets
# of the basic multilingual plane; an efficient representation
-# for all of UTF-16 has not yet been developed. This means,
+# for all of Unicode has not yet been developed. This means,
# in particular, that negated charsets cannot be represented as
# bigcharsets.
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 579229a..a8928ee 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1117,6 +1117,16 @@
self.assertEqual(pmap(sqr, range(100), chunksize=20),
map(sqr, range(100)))
+ def test_map_unplicklable(self):
+ # Issue #19425 -- failure to pickle should not cause a hang
+ if self.TYPE == 'threads':
+ return
+ class A(object):
+ def __reduce__(self):
+ raise RuntimeError('cannot pickle')
+ with self.assertRaises(RuntimeError):
+ self.pool.map(sqr, [A()]*10)
+
def test_map_chunksize(self):
try:
self.pool.map_async(sqr, [], chunksize=1).get(timeout=TIMEOUT1)
diff --git a/Misc/NEWS b/Misc/NEWS
index 79ab674..71de138 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1,6 +1,18 @@
Python News
+++++++++++
+What's New in Python 2.7.7?
+===========================
+
+*Release date: XXXX-XX-XX*
+
+Core and Builtins
+-----------------
+
+Library
+-------
+
+
Whats' New in Python 2.7.6?
===========================
diff --git a/Modules/_sre.c b/Modules/_sre.c
index a7103cc..bf802a6 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2753,8 +2753,7 @@
\_________\_____/ /
\____________/
- It also helps that SRE_CODE is always an unsigned type, either 2 bytes or 4
- bytes wide (the latter if Python is compiled for "wide" unicode support).
+ It also helps that SRE_CODE is always an unsigned type.
*/
/* Defining this one enables tracing of the validator */