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
Victor Stinner [Sat, 21 Mar 2015 14:04:43 +0000 (15:04 +0100)]
Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error) in
the exception message.
Add also unit test to check that the exception contains the name of the
function.
Special case: the final _PyEval_EvalFrameEx() check doesn't mention the
function since it didn't execute a single function but a whole frame.
Serhiy Storchaka [Sat, 21 Mar 2015 07:41:19 +0000 (09:41 +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.
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.
Serhiy Storchaka [Fri, 20 Mar 2015 18:04:21 +0000 (20:04 +0200)]
Issue #22832: Tweaked parameter names for fcntl module to better match
official POSIX documentation. Updated the documenttion for Python 3.
Patch by Alex Shkop.
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:12:43 +0000 (16:12 +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.
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.
Victor Stinner [Fri, 20 Mar 2015 12:48:36 +0000 (13:48 +0100)]
Issue #23696: Remove test on ZipImportError.__context__ because the context is
None on Windows.
When the file is not readable, the error occurs at open on UNIX. On Windows,
the error only occurs at the first operation on the open file. It would require
to many changes to set __context__ to an OSError for all file operations, for a
little benefit (__context__ is almost never used).
Victor Stinner [Fri, 20 Mar 2015 11:54:28 +0000 (12:54 +0100)]
Issue #23715: signal.sigwaitinfo() and signal.sigtimedwait() are now retried
when interrupted by a signal not in the *sigset* parameter, if the signal
handler does not raise an exception. signal.sigtimedwait() recomputes the
timeout with a monotonic clock when it is retried.
Remove test_signal.test_sigwaitinfo_interrupted() because sigwaitinfo() doesn't
raise InterruptedError anymore if it is interrupted by a signal not in its
sigset parameter.
Victor Stinner [Fri, 20 Mar 2015 10:21:41 +0000 (11:21 +0100)]
Issue #23708: Split assertion expression in two assertions in _Py_read() and
_Py_write() to know which test failed on the buildbot "AMD64 Snow Leop 3.x".
Serhiy Storchaka [Fri, 20 Mar 2015 07:21:59 +0000 (09:21 +0200)]
Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
compatible with regular files (in particular it now supports the context
management protocol).
Serhiy Storchaka [Fri, 20 Mar 2015 07:00:36 +0000 (09:00 +0200)]
Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable
bytes-like object too.
Victor Stinner [Fri, 20 Mar 2015 00:42:20 +0000 (01:42 +0100)]
Issue #23646: Enhance precision of time.sleep() and socket timeout when
interrupted by a signal
Add a new _PyTime_AddDouble() function and remove _PyTime_ADD_SECONDS() macro.
The _PyTime_ADD_SECONDS only supported an integer number of seconds, the
_PyTime_AddDouble() has subsecond resolution.
Victor Stinner [Thu, 19 Mar 2015 21:53:20 +0000 (22:53 +0100)]
Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handle
EINTR error and special cases for Windows.
These functions now truncate the length to PY_SSIZE_T_MAX to have a portable
and reliable behaviour. For example, read() result is undefined if counter is
greater than PY_SSIZE_T_MAX on Linux.
Victor Stinner [Thu, 19 Mar 2015 20:54:09 +0000 (21:54 +0100)]
Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now
retried with the recomputed delay, except if the signal handler raises an
exception (PEP 475).
Modify also test_signal to use a monotonic clock instead of the system clock.
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
Ethan Furman [Thu, 19 Mar 2015 00:27:57 +0000 (17:27 -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
Victor Stinner [Wed, 18 Mar 2015 13:39:33 +0000 (14:39 +0100)]
Issue #22181: On Linux, os.urandom() now uses the new getrandom() syscall if
available, syscall introduced in the Linux kernel 3.17. It is more reliable
and more secure, because it avoids the need of a file descriptor and waits
until the kernel has enough entropy.
Serhiy Storchaka [Wed, 18 Mar 2015 08:59:57 +0000 (10:59 +0200)]
Issue #2211: Updated the implementation of the http.cookies.Morsel class.
Setting attributes key, value and coded_value directly now is deprecated.
update() and setdefault() now transform and check keys. Comparing for
equality now takes into account attributes key, value and coded_value.
copy() now returns a Morsel, not a dict. repr() now contains all attributes.
Optimized checking keys and quoting values. Added new tests.
Original patch by Demian Brecht.
Victor Stinner [Tue, 17 Mar 2015 23:22:14 +0000 (00:22 +0100)]
Issue #23694: Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an
OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
held
Victor Stinner [Tue, 17 Mar 2015 21:53:27 +0000 (22:53 +0100)]
Issue #23644: Fix issues with C++ when compiling Python extensions
Disable completly pyatomic.h on C++, because <stdatomic.h> is not compatible with C++.
<pyatomic.h> is only needed by the optimized PyThreadState_GET() macro in
pystate.h. Instead, declare PyThreadState_GET() as an alias to
PyThreadState_Get(), as done for limited API.
Robert Collins [Tue, 17 Mar 2015 20:54:50 +0000 (09:54 +1300)]
Issue #18983: Allow selection of output units in timeit.
This allows manual selection of a specific unit such as usecs rather than the
use of a heuristic. This is intended to aid machine processing of timeit
output.