Commit Graph

88730 Commits

Author SHA1 Message Date
Victor Stinner 54799672da Issue #23708: select.devpoll now retries its internal write() when interrupted
by a signal (EINTR).

Modify devpoll_flush() to use _Py_write() instead of calling directly write().
2015-03-19 23:33:09 +01:00
Antoine Pitrou 31084ba528 Issue #23632: Memoryviews now allow tuple indexing (including for multi-dimensional memoryviews). 2015-03-19 23:29:36 +01:00
Victor Stinner c7cd12da60 Issue #22181: Fix dev_urandom_noraise(), try calling py_getrandom() before
opening /dev/urandom.
2015-03-19 23:24:45 +01:00
Victor Stinner 66aab0c4b5 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.
2015-03-19 22:53:20 +01:00
Victor Stinner 9eb57c5fa5 Issue #22181: The availability of the getrandom() is now checked in configure,
and stored in pyconfig.h as the new HAVE_GETRANDOM_SYSCALL define.

Fix os.urandom() tests using file descriptors if os.urandom() uses getrandom().
2015-03-19 22:21:49 +01:00
Victor Stinner 79d68f929d 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.
2015-03-19 21:54:09 +01:00
Serhiy Storchaka 0ed56a0b42 Fixed Misc/NEWS entry for issue #23136. 2015-03-19 19:54:51 +02:00
Serhiy Storchaka 64c439d3ae Fixed Misc/NEWS entry for issue #23136. 2015-03-19 19:52:50 +02:00
Serhiy Storchaka fc7344a792 Issue #23136: _strptime now uniformly handles all days in week 0, including
Jan 30 of previous year.  Based on patch by Jim Carroll.
2015-03-19 19:14:15 +02:00
Serhiy Storchaka 423feea01e Issue #23136: _strptime now uniformly handles all days in week 0, including
Jan 30 of previous year.  Based on patch by Jim Carroll.
2015-03-19 19:13:37 +02:00
Serhiy Storchaka 4f418d3671 Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to
NamedTemporaryFile instance.  Patch by Bohuslav Kabrda.
2015-03-19 15:24:27 +02:00
Serhiy Storchaka 56cefa69ee Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to
NamedTemporaryFile instance.  Patch by Bohuslav Kabrda.
2015-03-19 15:23:15 +02:00
Benjamin Peterson 41ce610d4c merge 3.4 2015-03-18 21:36:23 -05:00
Benjamin Peterson 86fdbf3152 wrap properly 2015-03-18 21:35:38 -05:00
Ethan Furman 8a0b9a4bf3 null merge from 3.4 2015-03-18 18:26:08 -07:00
Ethan Furman 482fe0477e 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
2015-03-18 18:19:30 -07:00
Ethan Furman 24e837f231 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
2015-03-18 17:27:57 -07:00
Antoine Pitrou 8eef6a9ad0 Issue #22903: The fake test case created by unittest.loader when it fails importing a test module is now picklable. 2015-03-19 00:01:37 +01:00
Antoine Pitrou d833779cea Issue #22903: The fake test case created by unittest.loader when it fails importing a test module is now picklable. 2015-03-18 23:56:46 +01:00
Antoine Pitrou 52a05ab524 Issue #23353: improve exceptions tests for generators 2015-03-18 22:23:40 +01:00
Antoine Pitrou c4c19b3938 Issue #23353: improve exceptions tests for generators 2015-03-18 22:22:46 +01:00
Serhiy Storchaka 009b811d67 Removed unintentional trailing spaces in non-external and non-generated C files. 2015-03-18 21:53:15 +02:00
Serhiy Storchaka 6c32585f67 Restored backward compatibility of pickling http.cookies.Morsel. It was
broken after converting instance attributes to properies in issue #2211.
2015-03-18 18:03:40 +02:00
Victor Stinner cb7e5f6f08 Merge 3.4 (tracemalloc typo) 2015-03-18 16:05:32 +01:00
Victor Stinner 444f124fcf _tracemalloc.c: Fix typo 2015-03-18 16:05:18 +01:00
Victor Stinner e371b3d21a Fix compiler warning in mmapmodule.c (compare signed/unsigned integers) 2015-03-18 15:04:34 +01:00
Victor Stinner 0c39b1b970 Initialize variables to prevent GCC warnings 2015-03-18 15:02:06 +01:00
Victor Stinner 938b0b9fee Fix compiler warning in dtoa.c 2015-03-18 15:01:44 +01:00
Victor Stinner 59f7fb29ec 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.
2015-03-18 14:39:33 +01:00
Victor Stinner 072248ec63 Merge 3.4 (linecache doc) 2015-03-18 14:19:19 +01:00
Victor Stinner 376658fa13 Issue #11726: Fix linecache example in the doc
Use a Python source file (linecache.__file__) instead of /etc/passwd.

Modify also linecache docstrings to clarify the linecache is written to cache
Python source files, not any text files.
2015-03-18 14:16:50 +01:00
Victor Stinner 58b8f3923e Merge 3.4 (linecache doc) 2015-03-18 14:14:52 +01:00
Victor Stinner 93f0665fb6 Issue #11726: clarify linecache doc: linecache is written to cache Python
source files, even if "it works" with other text files encoded to UTF-8.
2015-03-18 14:14:42 +01:00
Victor Stinner de31134558 Issue #12155: Fix queue doc example to join threads
Use None as a sentinel to stop a worker.
2015-03-18 14:05:43 +01:00
Victor Stinner 926ce70066 Merge 3.4 (marshal doc) 2015-03-18 13:59:02 +01:00
Victor Stinner 6a318d420a Issue #19428: Document that PyMarshal_ReadLongFromFile() and
PyMarshal_ReadShortFromFile() can fail.
2015-03-18 13:58:49 +01:00
Victor Stinner 5200f55024 Issue #19428: Handle PyMarshal_Read*() errors in run_pyc_file()
Detect also earlier PyMarshal_Read*() errors in zipimport.
2015-03-18 13:56:25 +01:00
Victor Stinner 50931f41d0 Merge 3.4 (asyncio) 2015-03-18 11:37:54 +01:00
Victor Stinner d6dc7bdaf9 Issue #23456: Add missing @coroutine decorators in asyncio 2015-03-18 11:37:42 +01:00
Victor Stinner 7fea974baf Issue #23605: Fix os.walk(topdown=True), don't cache entry.is_symlink() because
the caller can replace the directory with a different file kind.

The bottom-up way, os.walk(topdown=False), still uses entry.is_symlink(), and
so can be faster than Python 3.4.
2015-03-18 11:29:47 +01:00
Victor Stinner a47fc5c2dd Issue #23694: Handle EINTR in _Py_open() and _Py_fopen_obj()
Retry open()/fopen() if it fails with EINTR and the Python signal handler
doesn't raise an exception.
2015-03-18 09:52:54 +01:00
Serhiy Storchaka 9c1a9b2657 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.
2015-03-18 10:59:57 +02:00
Vinay Sajip 3505bd82a9 Issue #23207: merged fix from 3.4. 2015-03-18 08:49:57 +00:00
Vinay Sajip d55436ace3 Issue #23207: Improved kwarg validation. 2015-03-18 08:47:58 +00:00
Victor Stinner e42ccd2bfd Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
* If fopen() fails, OSError is raised with the original filename object.
* The GIL is now released while calling fopen()
2015-03-18 01:39:23 +01:00
Victor Stinner a555cfcb73 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
2015-03-18 00:22:14 +01:00
Victor Stinner 6562b29e13 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.
2015-03-17 22:53:27 +01:00
Robert Collins b28de01992 Fix patch attribution for issue 18983. 2015-03-18 09:59:33 +13:00
Robert Collins 302dbc6792 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.

Patch by Serhiy Storchaka.
2015-03-18 09:54:50 +13:00
Victor Stinner f024d263b4 Issue #23685: Fix usage of PyMODINIT_FUNC in _json, _scproxy, nis, pyexpat
_codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw
modules.

pyexpat.c doesn't need to redeclare PyMODINIT_FUNC, it's already declared in
Include/pyport.h.
2015-03-17 17:48:27 +01:00