Commit Graph

36853 Commits

Author SHA1 Message Date
Serhiy Storchaka 1770fde94c Make some tests more frienly to MemoryError.
Free memory, unlock hanging threads.
2015-03-28 20:39:51 +02:00
Serhiy Storchaka 9db55004a1 Make some tests more frienly to MemoryError.
Free memory, unlock hanging threads.
2015-03-28 20:38:37 +02:00
Victor Stinner 02937aab13 Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
2015-03-28 05:02:39 +01:00
Victor Stinner 95e9cef6f0 Issue #22117: Write unit tests for _PyTime_AsTimeval()
* _PyTime_AsTimeval() now ensures that tv_usec is always positive
* _PyTime_AsTimespec() now ensures that tv_nsec is always positive
* _PyTime_AsTimeval() now returns an integer on overflow instead of raising an
  exception
2015-03-28 01:26:47 +01:00
Victor Stinner 34dc0f46ae Issue #22117: The signal modules uses the new _PyTime_t API
* Add _PyTime_AsTimespec()
* Add unit tests for _PyTime_AsTimespec()
2015-03-27 18:19:03 +01:00
Victor Stinner 4bfb460d88 Issue #22117: time.monotonic() now uses the new _PyTime_t API
* Add _PyTime_FromNanoseconds()
* Add _PyTime_AsSecondsDouble()
* Add unit tests for _PyTime_AsSecondsDouble()
2015-03-27 22:27:24 +01:00
Brett Cannon ac9591a44a Remove a dead test for a never-launched API 2015-03-27 14:21:26 -04:00
Brett Cannon ff7f428b38 Merge 2015-03-27 12:57:16 -04:00
Brett Cannon 781692ff6a Fix module deprecation warnings to have a useful stacklevel 2015-03-27 12:56:57 -04:00
Victor Stinner 992c43fec9 Issue #22117: Fix rounding in _PyTime_FromSecondsObject()
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject()
* Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject()
* Add unit tests
2015-03-27 17:12:45 +01:00
Victor Stinner 79644f9c83 Issue #22117: Fix test_gdb for the new time.sleep()
Use time.gmtime() instead of time.sleep(), because time.sleep() is no more
declared with METH_VARARGS but with METH_O. time.gmtime() is still declared
with METH_VARARGS and so it is called with PyCFunction_Call() which is the
target of the test_gdb unit test.
2015-03-27 15:42:37 +01:00
Victor Stinner ba508d5dd2 Merge 3.4 (test.support) 2015-03-27 15:36:15 +01:00
Victor Stinner d7aa5248fb Issue #23445: Fix test.support.python_is_optimized() for CFLAGS=-Og
-Og does not optimize the C code, it's just "fast debugging".
2015-03-27 15:36:01 +01:00
Victor Stinner 6b3af083ca Merge 3.4 (asyncio) 2015-03-27 15:20:37 +01:00
Victor Stinner 79fd962652 asyncio: Fix _SelectorTransport.__repr__() if the event loop is closed 2015-03-27 15:20:08 +01:00
Victor Stinner 59f6342c97 Issue #23715: Fix test_sigtimedwait() of test_eintr
sigtimedwait([], timeout) fails with OSError(EINVAL) on OpenIndiana, wait for a
signal which will never be received instead.
2015-03-27 14:32:22 +01:00
Serhiy Storchaka aa4c36fbbb Issue #23775: pprint() of OrderedDict now outputs the same representation
as repr().
2015-03-26 08:51:33 +02:00
Serhiy Storchaka f3fa308817 Issue #23776: Removed asserts from pprint.PrettyPrinter constructor. 2015-03-26 08:43:21 +02:00
Steve Dower e6bb7eb27b Issue #23765: Removed IsBadStringPtr calls in ctypes 2015-03-25 21:58:36 -07:00
Serhiy Storchaka 632a77e6a3 Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
Serhiy Storchaka 7c316a181a Check that failed writerow() doesn't produce change a file. 2015-03-25 19:16:54 +02:00
Serhiy Storchaka 0b4e355b8e Check that failed writerow() doesn't produce change a file. 2015-03-25 19:16:15 +02:00
Serhiy Storchaka b20f905f6d Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. 2015-03-25 16:41:15 +02:00
Serhiy Storchaka 1b87ae0c91 Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. 2015-03-25 16:40:15 +02:00
Serhiy Storchaka 764fc9bfac Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive
creation) mode.
2015-03-25 10:09:41 +02:00
Serhiy Storchaka b0749ca933 Fixed bytes warnings when run tests with -vv. 2015-03-25 01:33:19 +02:00
Serhiy Storchaka 7665be6087 Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
2015-03-24 23:21:57 +02:00
Serhiy Storchaka 8ffe917cee 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.
2015-03-24 22:28:43 +02:00
Serhiy Storchaka be1eb14241 Added tests for mixed kinds of Unicode strings. 2015-03-24 21:48:30 +02:00
Serhiy Storchaka 6c86fe2d4b Issue #23583: Added tests for standard IO streams in IDLE. 2015-03-24 19:46:54 +02:00
Serhiy Storchaka d4c2ac8394 Issue #21560: An attempt to write a data of wrong type no longer cause
GzipFile corruption.  Original patch by Wolfgang Maier.
2015-03-23 15:25:43 +02:00
R David Murray 936da2a796 #23647: Increase imaplib's MAXLINE to accommodate modern mailbox sizes. 2015-03-22 16:17:46 -04:00
R David Murray beed8402ca #23539: Set Content-Length to 0 for PUT, POST, and PATCH if body is None.
Some http servers will reject PUT, POST, and PATCH requests if they
do not have a Content-Length header.

Patch by James Rutherford, with additional cleaning up of the
'request' documentation by me.
2015-03-22 15:18:23 -04:00
R David Murray 75ed90a4cf #23700: fix/improve comment 2015-03-22 12:33:46 -04:00
Ned Deily ce8f5ded65 Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout. 2015-03-22 01:14:48 -07:00
Serhiy Storchaka 52027c301a 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.
2015-03-21 09:40:26 +02:00
Serhiy Storchaka 09ce2786e4 Fixed bytes warnings when run tests with -vv. 2015-03-25 01:34:03 +02:00
Serhiy Storchaka 15fa1c4ade Fixed using deprecated escaping in regular expression in _strptime.py (issue23622). 2015-03-25 01:21:50 +02:00
Serhiy Storchaka 8be6be427d Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
2015-03-24 23:23:28 +02:00
Serhiy Storchaka a54aae0683 Issue #23622: Unknown escapes in regular expressions that consist of ``'\'``
and ASCII letter now raise a deprecation warning and will be forbidden in
Python 3.6.
2015-03-24 22:58:14 +02:00
Serhiy Storchaka b876df4cbb 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.
2015-03-24 22:30:46 +02:00
Serhiy Storchaka f7ef47583e Added tests for mixed kinds of Unicode strings. 2015-03-24 21:49:53 +02:00
Serhiy Storchaka 520e00dd92 Issue #23583: Added tests for standard IO streams in IDLE. 2015-03-24 19:49:23 +02:00
Serhiy Storchaka 87eb482e30 Issue #23502: The pprint module now supports mapping proxies.
In particular the __dict__ attributes of building types.
2015-03-24 19:31:50 +02:00
Serhiy Storchaka 022f20376a Issue #17530: pprint now wraps long bytes objects and bytearrays. 2015-03-24 19:22:37 +02:00
Serhiy Storchaka 8e2aa88a40 Issue #23741: Slightly refactor the pprint module to make it a little more
extesible.  No public API is added.
2015-03-24 18:45:23 +02:00
Serhiy Storchaka 72bd327db0 Issue #22687: Fixed some corner cases in breaking words in tetxtwrap.
Got rid of quadratic complexity in breaking long words.
2015-03-24 18:32:27 +02:00
Serhiy Storchaka 32af7549a7 Issue #20289: The copy module now uses pickle protocol 4 (PEP 3154) and
supports copying of instances of classes whose __new__ method takes
keyword-only arguments.
2015-03-24 18:06:42 +02:00
Victor Stinner 944fbcc478 Issue #23571: Enhance _Py_CheckFunctionResult()
Too bad, sometimes Py_FatalError() is unable to write the exception into
sys.stderr (on "AMD64 OpenIndiana 3.x" buildbot, the buildbot was probably out
of memory).

Call Py_FatalError() with a different message for the two cases (result+error,
or no result and no error).
2015-03-24 16:28:52 +01:00
Victor Stinner 381a9bce97 Issue #23571: Update test_capi 2015-03-24 14:01:32 +01:00
Serhiy Storchaka bca63b362d Issue #23688: Added support of arbitrary bytes-like objects and avoided
unnecessary copying of memoryview in gzip.GzipFile.write().
Original patch by Wolfgang Maier.
2015-03-23 14:59:48 +02:00
Serhiy Storchaka 77d899726f Issue #23252: Added support for writing ZIP files to unseekable streams. 2015-03-23 01:09:35 +02:00
R David Murray 94a6448956 Merge: #23647: Increase imaplib's MAXLINE to accommodate modern mailbox sizes. 2015-03-22 16:18:59 -04:00
R David Murray 0a0d20edfb Merge: #23539: Set Content-Length to 0 for PUT, POST, and PATCH if body is None. 2015-03-22 15:19:01 -04:00
R David Murray 5d06c74f41 Merge: #23700: fix/improve comment 2015-03-22 12:34:50 -04:00
Paul Moore a4d4dd3a9d #23657 Don't explicitly do an isinstance check for str in zipapp
As a result, explicitly support pathlib.Path objects as arguments.
Also added tests for the CLI interface.
2015-03-22 15:32:36 +00:00
Ned Deily 2f7bf23925 Issue #22289: merge from 3.4 2015-03-22 01:19:10 -07:00
Victor Stinner 4f0efb0522 Issue #23571: Fix test_capi 2015-03-21 17:24:50 +01:00
Victor Stinner efde146b0c 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.
2015-03-21 15:04:43 +01:00
Raymond Hettinger 32ea16577d Issue 23704: Add index(), copy(), and insert() to deques. Register deques as a MutableSequence. 2015-03-21 01:37:37 -07:00
Serhiy Storchaka 0a9e2721fa 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.
2015-03-21 09:41:19 +02:00
Raymond Hettinger 39dadf7abf Issue 23705: Improve the performance of __contains__ checks for deques. 2015-03-20 16:38:56 -07:00
Serhiy Storchaka 1dd49824df Issue #23681: The -b option now affects comparisons of bytes with int. 2015-03-20 16:54:57 +02:00
Serhiy Storchaka ee4c0b9dcf Issue #23681: Fixed Python 2 to 3 poring bugs.
Indexing bytes retiurns an integer, not bytes.
2015-03-20 16:48:02 +02:00
Serhiy Storchaka 74a49ac3f5 Issue #23681: Fixed Python 2 to 3 poring bugs.
Indexing bytes retiurns an integer, not bytes.
2015-03-20 16:46:19 +02:00
Serhiy Storchaka 000391b7de 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.
2015-03-20 16:12:43 +02:00
Serhiy Storchaka d83b7c2df4 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.
2015-03-20 16:11:20 +02:00
Victor Stinner 268225f154 Issue #23715: Fix test_script_helper 2015-03-20 14:02:33 +01:00
Victor Stinner 57d516bd6b 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).
2015-03-20 13:48:36 +01:00
Victor Stinner 03129230c9 Issue #23715: Fix test_eintr, skip tests on signal.sigwaitinfo() and
signal.sigtimedwait() if functions are missing
2015-03-20 13:42:52 +01:00
Victor Stinner 1335ca5053 Issue #23715: Enhance test.script_helper to investigate test_eintr failure
If Python failed, show also stdout in the assertion error.
2015-03-20 13:38:08 +01:00
Victor Stinner a453cd8d85 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.
2015-03-20 12:54:28 +01:00
Victor Stinner fbd6f9ed12 Issue #23696: Chain ZipImportError to the OSError 2015-03-20 10:52:25 +01:00
Serhiy Storchaka 8490f5acfe 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.
2015-03-20 09:00:36 +02:00
Victor Stinner 9a8089b32a 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.
2015-03-20 01:42:20 +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 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 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 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 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 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 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
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
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