Victor Stinner [Tue, 7 Apr 2015 19:38:04 +0000 (21:38 +0200)]
Issue #23879, asyncio: SelectorEventLoop.sock_connect() must not call connect()
again if the first call to connect() raises an InterruptedError.
When the C function connect() fails with EINTR, the connection runs in
background. We have to wait until the socket becomes writable to be notified
when the connection succeed or fails.
Serhiy Storchaka [Tue, 31 Mar 2015 10:12:37 +0000 (13:12 +0300)]
Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings.
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
R David Murray [Mon, 30 Mar 2015 14:14:47 +0000 (10:14 -0400)]
#23792: also catch interrupt around pipe.write.
The previous patch only dealt with KeyboardInterrupt when all of the
data had been consumed by the pager. This deals with the interrupt
when some data is still pending.
R David Murray [Mon, 30 Mar 2015 01:53:05 +0000 (21:53 -0400)]
#23745: handle duplicate MIME parameter names in new parser.
This mimics get_param's error handling for the most part. It is slightly
better in some regards as get_param can produce some really weird results for
duplicate *0* parts. It departs from get_param slightly in that if we have a
mix of non-extended and extended pieces for the same parameter name, the new
parser assumes they were all supposed to be extended and concatenates all the
values, whereas get_param always picks the non-extended parameter value. All
of this error recovery is pretty much arbitrary decisions...
R David Murray [Sun, 29 Mar 2015 19:15:40 +0000 (15:15 -0400)]
#23792: Ignore KeyboardInterrupt when the pydoc pager is active.
Previously, if you hit ctl-c while the pager was active, the python that
launched the subprocess for the pager would see the KeyboardInterrupt in the
__exit__ method of the subprocess context manager where it was waiting for the
subprocess to complete, ending the wait. This would leave the pager running,
while the interactive interpreter, after handling the exception by printing
it, would go back to trying to post a prompt...but the pager would generally
have the terminal in raw mode, and in any case would be still trying to read
from stdin. On some systems, even exiting python at that point would not
restore the terminal mode. The problem with raw mode could also happen if
ctl-C was hit when pydoc was called from the shell command line and the pager
was active.
Instead, we now wait on the subprocess in a loop, ignoring KeyboardInterrupt
just like the pager does, until the pager actually exits.
(Note: this was a regression relative to python2...in python2 the pager
is called via system, and system does not return until the pager exits.)
Victor Stinner [Wed, 25 Mar 2015 00:54:46 +0000 (01:54 +0100)]
Issue #23571: Fix reentrant call to Py_FatalError()
Flushing sys.stdout and sys.stderr in Py_FatalError() can call again
Py_FatalError(). Add a reentrant flag to detect this case and just abort at the
second call.
Serhiy Storchaka [Tue, 24 Mar 2015 20:28:43 +0000 (22:28 +0200)]
Issue #23671: string.Template now allows to specify the "self" parameter as
keyword argument. string.Formatter now allows to specify the "self" and
the "format_string" parameters as keyword arguments.
Victor Stinner [Tue, 24 Mar 2015 12:44:35 +0000 (13:44 +0100)]
Issue #23571: Py_FatalError() now tries to flush sys.stdout and sys.stderr
It should help to see exceptions when stderr if buffered: PyErr_Display() calls
sys.stderr.write(), it doesn't write into stderr file descriptor directly.
Victor Stinner [Tue, 24 Mar 2015 10:24:06 +0000 (11:24 +0100)]
Issue #23571: Enhance Py_FatalError()
* Display the current Python stack if an exception was raised but the exception
has no traceback
* Disable faulthandler if an exception was raised (before it was only disabled
if no exception was raised)
* To display the current Python stack, call PyGILState_GetThisThreadState()
which works even if the GIL was released
Serhiy Storchaka [Sun, 22 Mar 2015 07:46:36 +0000 (09:46 +0200)]
Issue #22079: Deprecation warning now is issued in PyType_Ready() instead of
raising TypeError when statically allocated type subclasses dynamically
allocated type
Serhiy Storchaka [Sat, 21 Mar 2015 07:40:26 +0000 (09:40 +0200)]
Issue #22351: The nntplib.NNTP constructor no longer leaves the connection
and socket open until the garbage collector cleans them up. Patch by
Martin Panter.
R David Murray [Fri, 20 Mar 2015 15:31:38 +0000 (11:31 -0400)]
#11726: Make linecache docs reflect that all files are treated the same.
Being able to read non-python text files is not a purpose of linecache, but it
does work and people use it. This changeset adjusts the language to make it
clear that Python files are not treated uniquely, but does not go so far as to
say reading non-python files is explicitly supported.
Serhiy Storchaka [Fri, 20 Mar 2015 14:11:20 +0000 (16:11 +0200)]
Issue #23700: NamedTemporaryFile iterator closed underlied file object in
some circunstances while NamedTemporaryFile object was living. This causes
failing test_csv. Changed the implementation of NamedTemporaryFile.__iter__
to make tests passed.
Ethan Furman [Thu, 19 Mar 2015 01:19:30 +0000 (18:19 -0700)]
issue23673
add private method to enum to support replacing global constants with Enum members:
- search for candidate constants via supplied filter
- create new enum class and members
- insert enum class and replace constants with members via supplied module name
- replace __reduce_ex__ with function that returns member name, so previous Python versions can unpickle
modify IntEnum classes to use new method
Eli Bendersky [Sun, 15 Mar 2015 03:14:23 +0000 (20:14 -0700)]
Issue #23549: Clarify confusion in heapq doc - accessing the mininmal element
The current documentation only mentions heap[0] as the smallest element in the
beginning, and not in any of the methods' docs. There's no method to access the
minimal element without popping it, and the documentation of nsmallest is
confusing because it may suggest that min() is the way to go for n==1.