Commit Graph

22303 Commits

Author SHA1 Message Date
Yury Selivanov 7c3ac2d1f8 Merge 3.5 (issue #27040) 2016-05-16 15:32:26 -04:00
Serhiy Storchaka 4b23494ded Issue #27039: Fixed bytearray.remove() for values greater than 127.
Based on patch by Joe Jevnik.
2016-05-16 22:24:03 +03:00
Yury Selivanov 7ed7ce6ee7 Issue #27040: Add loop.get_exception_handler method 2016-05-16 15:20:38 -04:00
Serhiy Storchaka 7bf36dace8 Issue #27039: Fixed bytearray.remove() for values greater than 127.
Patch by Joe Jevnik.
2016-05-16 22:15:38 +03:00
Martin Panter 0b39a556e8 Issue #14132, Issue #17214: Merge two redirect handling fixes from 3.5 2016-05-16 07:45:28 +00:00
Serhiy Storchaka c944c2dab8 Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codes
in PyArg_ParseTuple().
2016-05-16 10:12:15 +03:00
Serhiy Storchaka f95455da4c Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codes
in PyArg_ParseTuple().
2016-05-16 10:11:47 +03:00
Serhiy Storchaka acef5de6ec Backported tests for issue #18531. 2016-05-16 09:55:32 +03:00
Serhiy Storchaka cbcc2fd641 Issue #27033: The default value of the decode_data parameter for
smtpd.SMTPChannel and smtpd.SMTPServer constructors is changed to False.
2016-05-16 09:36:31 +03:00
Serhiy Storchaka 98019e1cf6 Issue #27034: Removed deprecated class asynchat.fifo. 2016-05-16 09:10:43 +03:00
Martin Panter e6f060903c Issue #17214: Percent-encode non-ASCII bytes in redirect targets
Some servers send Location header fields with non-ASCII bytes, but "http.
client" requires the request target to be ASCII-encodable, otherwise a
UnicodeEncodeError is raised. Based on patch by Christian Heimes.

Python 2 does not suffer any problem because it allows non-ASCII bytes in the
HTTP request target.
2016-05-16 01:14:20 +00:00
Martin Panter ce6e06874b Issue #14132: Fix redirect handling when target is just a query string 2016-05-16 01:07:13 +00:00
Martin Panter 79f561d126 Issue #26870: Poll() also fails on OS X; try select()
Also work around separate Open BSD bug with kill() of a zombie.
2016-05-15 15:04:58 +00:00
Martin Panter 2e1d8683c1 Issue #26870: Avoid using kqueue() with pseudo-terminals
Also force terminate the child process in case it hangs for any reason.
2016-05-15 13:21:25 +00:00
Martin Panter 3e2a0715d7 Issue #26870: Temporary debugging for OS X Snow Leopard lockup 2016-05-15 03:59:59 +00:00
Martin Panter 3712686956 Issue #26870: Close pty master in case of exception 2016-05-15 03:05:36 +00:00
Martin Panter f0dbf7a6ab Issue #26870: Add readline.set_auto_history(), originally by Tyler Crompton 2016-05-15 01:26:25 +00:00
Yury Selivanov e9e3a7cd3c Merge 3.5 (asyncio) 2016-05-13 16:11:00 -04:00
Yury Selivanov f11352c114 asyncio/tests: Ensure a gc_collect for __del__ testing
Patch by Philip Jenvey
2016-05-13 16:10:43 -04:00
Yury Selivanov 2e413f7cc7 Merge 3.5 (asyncio) 2016-05-13 16:05:05 -04:00
Yury Selivanov 5dc093336f asyncio: Fix unix pipe transport 'repr' methods
Patch by Vincent Michel.
See also https://github.com/python/asyncio/pull/326
2016-05-13 16:04:43 -04:00
Yury Selivanov 91f9def428 Merge 3.5 (asyncio) 2016-05-13 15:43:05 -04:00
Yury Selivanov 04eb87e4ef asyncio: ease the cert failed regex
Patch by Philip Jenvey
2016-05-13 15:42:39 -04:00
Yury Selivanov 059320bab8 Merge 3.5 (issue #26848) 2016-05-13 15:39:09 -04:00
Yury Selivanov 7657f6ba21 Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input. 2016-05-13 15:35:28 -04:00
Serhiy Storchaka 91762da45b Restored test_interleaved. After issue #8886 it was a duplicate of
test_different_file.
2016-05-13 21:19:22 +03:00
Serhiy Storchaka d76c7c2bed Restored test_interleaved. After issue #8886 it was a duplicate of
test_different_file.
2016-05-13 21:18:58 +03:00
Serhiy Storchaka 18ee29d0b8 Issue #26039: zipfile.ZipFile.open() can now be used to write data into a ZIP
file, as well as for extracting data.  Patch by Thomas Kluyver.
2016-05-13 13:52:49 +03:00
Senthil Kumaran 5d1110a952 merge from 3.5
Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler.

Patch contributed by Chi Hsuan Yen.
2016-05-13 01:35:29 -07:00
Senthil Kumaran 9642eedc0a Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler.
Patch contributed by Chi Hsuan Yen.
2016-05-13 01:32:42 -07:00
Martin Panter f94ec1bd83 Issue #22274: Merge stderr=STDOUT fix from 3.5 2016-05-13 07:45:21 +00:00
Martin Panter c76358924f Issue #22274: Redirect stderr=STDOUT when stdout not redirected, by Akira Li 2016-05-13 01:54:44 +00:00
Serhiy Storchaka e78592d42c Make bytes and bytearray subclass tests compatible with base types tests. 2016-05-12 12:33:21 +03:00
Serhiy Storchaka ea36c941a1 Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. 2016-05-12 10:37:58 +03:00
Eric Snow 228ab1ff6b Issue #21099: Switch applicable importlib tests to use PEP 451 API. 2016-05-10 16:21:03 -06:00
Serhiy Storchaka 3fa86a0612 Make bytes and bytearray subclass tests compatible with base types tests. 2016-05-12 12:33:41 +03:00
Serhiy Storchaka 1f364438ad Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. 2016-05-12 10:39:32 +03:00
Eric Snow d65018b17c Fixes #19711: Add tests for reloading namespace packages. 2016-05-10 15:29:05 -06:00
Serhiy Storchaka 3e99fdeed5 Issue #26881: The modulefinder module now supports extended opcode arguments. 2016-05-08 23:44:54 +03:00
Serhiy Storchaka 02d9f5e5b2 Issue #26881: The modulefinder module now supports extended opcode arguments. 2016-05-08 23:43:50 +03:00
Serhiy Storchaka ce41287e99 Issue #18531: Single var-keyword argument of dict subtype was passed
unscathed to the C-defined function.  Now it is converted to exact dict.
2016-05-08 23:36:44 +03:00
Serhiy Storchaka dea76376cb Issue #23815: Fixed crashes related to directly created instances of types in
_tkinter and curses.panel modules.
2016-05-08 20:46:55 +03:00
Serhiy Storchaka e3f1b0911e Issue #23815: Fixed crashes related to directly created instances of types in
_tkinter and curses.panel modules.
2016-05-08 20:46:22 +03:00
Martin Panter 1ce738e08f Merge typo fixes from 3.5 2016-05-08 14:02:35 +00:00
Martin Panter f0564164ba Fix typos in comments, documentation and test method names 2016-05-08 13:48:10 +00:00
Berker Peksag ca716cfbf3 Fix self.fail() call in test_data_header 2016-05-07 16:59:01 +03:00
Berker Peksag ad1fd346b2 Fix self.fail() call in test_data_header 2016-05-07 16:58:41 +03:00
Berker Peksag a8e3b0a16b Replace example.com with pythontest.net in test_urllibnet
example.com/404 returns 500 instead of 404 now.
2016-05-07 16:37:35 +03:00
Berker Peksag a40b0ef6e2 Replace example.com with pythontest.net in test_urllibnet
example.com/404 returns 500 instead of 404 now.
2016-05-07 16:37:09 +03:00
Serhiy Storchaka 17e22959a4 Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
Patch by Georg Brandl.
2016-05-07 15:43:59 +03:00
Serhiy Storchaka 21eb48764c Issue #17765: weakref.ref() no longer silently ignores keyword arguments.
Patch by Georg Brandl.
2016-05-07 15:41:09 +03:00
Terry Jan Reedy 234480df1c Merge with 3.5 2016-05-06 17:35:21 -04:00
Terry Jan Reedy f73a48cbb2 Issue 26912: fix broken imports in test_email package. 2016-05-06 17:35:05 -04:00
Raymond Hettinger 584e8aedc3 Issue 26915: Add identity checks to the collections ABC __contains__ methods. 2016-05-05 11:14:06 +03:00
Serhiy Storchaka d7062de95d Issue #26918: Skipped some tests in test_pipes on Android.
Patch by Xavier de Gaye.
2016-05-05 10:55:45 +03:00
Steven D'Aprano 3b06e24352 Issue 26002 and 25974
patches by Upendra Kumar and Stefan Krah
speed up median by using bisect, and general speedup for Decimals using as_integer_ratio
2016-05-05 03:54:29 +10:00
Serhiy Storchaka 45cdcd93c9 Issue #26873: xmlrpc now raises ResponseError on unsupported type tags
instead of silently return incorrect result.
2016-05-04 11:27:17 +03:00
Serhiy Storchaka 290fed43d9 Issue #26873: xmlrpc now raises ResponseError on unsupported type tags
instead of silently return incorrect result.
2016-05-04 11:26:42 +03:00
Serhiy Storchaka 0e120525f0 Issue #24950: Fixed expanduser tests when the users home directory in pwd is "/".
Based on patch by SilentGhost.
2016-05-03 21:17:52 +03:00
Serhiy Storchaka a3fd0b26ba Issue #24950: Fixed expanduser tests when the users home directory in pwd is "/".
Based on patch by SilentGhost.
2016-05-03 21:17:03 +03:00
Ethan Furman 354706915c issue26893: use mro() to examine class heirarchy 2016-05-01 10:04:21 -07:00
Ethan Furman 3803ad47bb issue26893: use mro() to examine class heirarchy 2016-05-01 10:03:53 -07:00
Serhiy Storchaka 47d1d7f48a Issue #26711: Fixed the comparison of plistlib.Data with other types. 2016-05-01 13:36:42 +03:00
Serhiy Storchaka dd1bcdf618 Issue #26711: Fixed the comparison of plistlib.Data with other types. 2016-05-01 13:36:16 +03:00
Martin Panter 51b697b7f3 Issue #26864: Merge no_proxy fixes from 3.5 2016-04-30 01:30:57 +00:00
Martin Panter aa27982ffc Issue #26864: Fix case insensitivity and suffix comparison with no_proxy
Patch by Xiang Zhang.
2016-04-30 01:03:40 +00:00
Berker Peksag 0a5bd51dd3 Issue #13436: Add a test to make sure that ast.ImportFrom(level=None) works 2016-04-29 19:50:02 +03:00
Berker Peksag dd745cc3ff Issue #25551: Test condition behavior instead of its internals
test_reset_internal_locks was looking at Event's _cond._lock. This
makes it harder to change internals of the Condition object and
makes the test fragile.

The test was added by Nir Soffer in 6108d30dde21.

Patch by Nir Soffer.
2016-04-29 17:25:51 +03:00
Berker Peksag 6d34bbbfc7 Issue #25551: Test condition behavior instead of its internals
test_reset_internal_locks was looking at Event's _cond._lock. This
makes it harder to change internals of the Condition object and
makes the test fragile.

The test was added by Nir Soffer in 6108d30dde21.

Patch by Nir Soffer.
2016-04-29 17:25:29 +03:00
Serhiy Storchaka b275210a3b Issue #25788: fileinput.hook_encoded() now supports an "errors" argument
for passing to open.  Original patch by Joseph Hackman.
2016-04-27 23:13:46 +03:00
Serhiy Storchaka cd9b5c2f40 Issue #26634: recursive_repr() now sets __qualname__ of wrapper.
Patch by Xiang Zhang.
2016-04-26 09:31:11 +03:00
Serhiy Storchaka b3b366d803 Issue #26634: recursive_repr() now sets __qualname__ of wrapper.
Patch by Xiang Zhang.
2016-04-26 09:30:44 +03:00
Senthil Kumaran 0996fa3bd8 merge 3.5
Issue #26804: urllib.request will prefer lower_case proxy environment variables
over UPPER_CASE or Mixed_Case ones.

Patch contributed by Hans-Peter Jansen. Reviewed by Martin Panter and Senthil Kumaran.
2016-04-25 08:18:07 -07:00
Senthil Kumaran a7c0ff2f0b Issue #26804: urllib.request will prefer lower_case proxy environment variables
over UPPER_CASE or Mixed_Case ones.

Patch contributed by Hans-Peter Jansen. Reviewed by Martin Panter and Senthil Kumaran.
2016-04-25 08:16:23 -07:00
Serhiy Storchaka a6f26c1d34 Remove more unused imports in tests. 2016-04-25 00:05:30 +03:00
Serhiy Storchaka fd2839e1de Merge 3.5 2016-04-24 23:53:16 +03:00
Serhiy Storchaka 5b6f0aa71c Remove duplicated tests.
There were duplicated methods with the same name and body.
2016-04-24 23:50:18 +03:00
Serhiy Storchaka e4fbb0206d Remove unused support.run_unittest imports.
It is not needed since tests use unittest.main().
2016-04-24 23:42:49 +03:00
Serhiy Storchaka e437a10d15 Issue #23277: Remove unused imports in tests. 2016-04-24 21:41:02 +03:00
Serhiy Storchaka 597d15afe4 Issue #23277: Remove unused support.run_unittest import. 2016-04-24 13:45:58 +03:00
Serhiy Storchaka c7f44aa99a Issue #23277: Remove more unused sys and os imports. 2016-04-24 13:25:01 +03:00
Serhiy Storchaka 18a8affc8e Issue #26801: shutil.get_terminal_size() now handles the case of stdout is
reopened on Windows.  Added tests for fallbacks.
2016-04-24 09:59:17 +03:00
Serhiy Storchaka d30829def2 Issue #26801: shutil.get_terminal_size() now handles the case of stdout is
reopened on Windows.  Added tests for fallbacks.
2016-04-24 09:58:43 +03:00
Berker Peksag 1e8ee9b380 Issue #23277: Remove unused sys and os imports
Patch by Jon Dufresne.
2016-04-24 07:31:42 +03:00
Berker Peksag e50d8465ab Issue #26041: Remove "will be removed in Python 3.7" from description messages
We will keep platform.dist() and platform.linux_distribution() to make porting
from Python 2 easier.

Patch by Kumaripaba Miyurusara Athukorala.
2016-04-24 03:32:50 +03:00
Berker Peksag 8d8221f0d6 Issue #26041: Remove "will be removed in Python 3.7" from description messages
We will keep platform.dist() and platform.linux_distribution() to make porting
from Python 2 easier.

Patch by Kumaripaba Miyurusara Athukorala.
2016-04-24 03:32:24 +03:00
Serhiy Storchaka 745145a7da Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
2016-04-23 10:53:43 +03:00
Serhiy Storchaka c2a2a751cf Issue #26822: itemgetter, attrgetter and methodcaller objects no longer
silently ignore keyword arguments.
2016-04-23 10:51:39 +03:00
Serhiy Storchaka 8b9eefc363 Issue #26733: Disassembling a class now disassembles class and static methods.
Patch by Xiang Zhang.
2016-04-23 09:24:29 +03:00
Serhiy Storchaka 585c93daea Issue #26733: Disassembling a class now disassembles class and static methods.
Patch by Xiang Zhang.
2016-04-23 09:23:52 +03:00
Martin Panter 614827c149 Additional grammar fix 2016-04-19 04:05:59 +00:00
Martin Panter abe4d52a1a Merge doc and comment fixes from 3.5 2016-04-19 23:23:16 +00:00
Victor Stinner 5bfe0da808 Merge 3.5: issue #26801 2016-04-19 22:29:11 +02:00
Victor Stinner 119ebb70e9 Fix shutil.get_terminal_size() error handling
Issue #26801: Fix error handling in shutil.get_terminal_size(), catch
AttributeError instead of NameError. Patch written by Emanuel Barry.

test_shutil: skip the functional test using "stty size" command if
os.get_terminal_size() is missing.
2016-04-19 22:24:56 +02:00
Zachary Ware edaf8653c6 Merge with 3.5 2016-04-19 11:49:56 -05:00
Zachary Ware 75b1bdcafa Replace assert statements with self.assertXxx() calls
Sync with upstream, see github.com/python/typing/pull/205
2016-04-19 11:49:37 -05:00
Lars Gustäbel daac5f9f92 Issue #24838: Merge test_tarfile.py fix from 3.5. 2016-04-19 11:59:39 +02:00
Lars Gustäbel ddd9917ac3 Issue #24838: Fix test_tarfile.py for non-utf8 filesystem encodings. 2016-04-19 11:58:41 +02:00
Lars Gustäbel 7c3e6848f2 Issue #24838: Merge tarfile fix from 3.5. 2016-04-19 08:53:14 +02:00
Lars Gustäbel 0f450abec4 Issue #24838: tarfile's ustar and gnu formats now correctly calculate name and
link field limits for multibyte character encodings like utf-8.
2016-04-19 08:43:17 +02:00
Martin Panter 8f26565ba9 Fix spelling (inital), grammar (may translates) in documentation, comments 2016-04-19 04:03:41 +00:00
Victor Stinner 0d88c65231 Backport test_gdb fix for s390x buildbots 2016-04-20 00:30:14 +02:00
Guido van Rossum 49ed08fd0b typing.py: merge 3.5->3.6 (Tuple/ellipsis/equality). 2016-04-18 07:39:54 -07:00
Guido van Rossum 5abcbb3ee5 typing.py: Consider ellipsis in TupleMeta.__eq__. By Kalle Tuure. github.com/python/typing/pull/201. 2016-04-18 07:37:41 -07:00
Victor Stinner 27e1240af5 Merge 3.5 (test_asyncio) 2016-04-18 10:29:19 +02:00
Victor Stinner c1b578608e Fix test_asyncio.test_timeout_disable()
Issue #26777: Fix random failing of the test on the "AMD64 FreeBSD 9.x 3.5"
buildbot:

    File ".../Lib/test/test_asyncio/test_tasks.py", line 2398, in go
      self.assertTrue(0.09 < dt < 0.11, dt)
    AssertionError: False is not true : 0.11902812402695417

Replace "< 0.11" with "< 0.15".
2016-04-18 10:28:42 +02:00
Martin Panter 791ac54a44 Issue #26657: Merge http.server fix from 3.5 2016-04-18 07:16:17 +00:00
Martin Panter d274b3f1f1 Issue #26657: Fix Windows directory traversal vulnerability with http.server
Based on patch by Philipp Hagemeister.  This fixes a regression caused by
revision f4377699fd47.
2016-04-18 03:45:18 +00:00
Guido van Rossum f0f1d365c8 Sync test_typing.py with upstream git repo (typing.py was already synced). (3.5->3.6) 2016-04-17 17:53:50 -07:00
Guido van Rossum 6aafbd433d Sync test_typing.py with upstream git repo (typing.py was already synced). 2016-04-17 17:52:05 -07:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Martin Panter d77133b4ce Issue #26717: Merge wsgiref fix from 3.5 2016-04-17 02:36:50 +00:00
Martin Panter 50dd1f7dd6 Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8
Patch by Anthony Sottile.
2016-04-17 02:17:03 +00:00
Martin Panter 528619b6c3 Issue #26782: Add STARTUPINFO to subprocess.__all__ on Windows 2016-04-16 23:42:37 +00:00
Martin Panter 9015eb4f74 Issue #26782: Merge test_subprocess from 3.5 2016-04-16 23:40:15 +00:00
Martin Panter 06172e7bd4 Issue #26782: Acknowledge the incomplete status of __all__ in 3.5
Handle is probably meant to be excluded, and STARTUPINFO will be added to
__all__ in 3.6.
2016-04-16 23:38:25 +00:00
Benjamin Peterson 50074f192d merge 3.5 2016-04-16 15:02:29 -07:00
Benjamin Peterson 8917226e4a test_support -> support 2016-04-16 15:02:23 -07:00
Benjamin Peterson 259d247b31 merge 3.5 (#26659) 2016-04-16 14:54:27 -07:00
Benjamin Peterson 2b601d3905 add gc support to slice (closes #26659) 2016-04-16 14:47:12 -07:00
Serhiy Storchaka 9e9235511e Issue #26783: test_os.WalkTests.test_walk_topdown did't test fwalk and bytes.
Patch by Aviv Palivoda.
2016-04-16 17:51:17 +03:00
Serhiy Storchaka a07ab29a79 Issue #26783: test_os.WalkTests.test_walk_topdown did't test fwalk and bytes.
Patch by Aviv Palivoda.
2016-04-16 17:51:00 +03:00
Senthil Kumaran 4d4ac5bd02 merge 3.5
issue26775 - Improve test coverage for urllib.parse
Patch contributed by Luiz Poleto.
2016-04-16 07:34:24 -07:00
Senthil Kumaran e38415e776 issue26775 - Improve test coverage for urllib.parse
Patch contributed by Luiz Poleto.
2016-04-16 07:33:15 -07:00
Martin Panter 5cad060e0d Merge subprocess test from 3.5 2016-04-16 11:51:31 +00:00
Martin Panter 23172bd47b Issue #10838: Run test__all__() everywhere, even if poll() is not available 2016-04-16 11:28:10 +00:00
Martin Panter 8b04a945ef Merge typo fixes from 3.5 2016-04-16 09:29:17 +00:00
Martin Panter 119e502277 Fix typos in code comments and documentation 2016-04-16 09:28:57 +00:00
Victor Stinner e914d41312 Issue #26766: Fix _PyBytesWriter_Finish()
Return a bytearray object when bytearray is requested and when the small buffer
is used.

Fix also test_bytes: bytearray%args must return a bytearray type.
2016-04-15 17:52:27 +02:00
Serhiy Storchaka c9a59e6e4f Issue #26764: Fixed SystemError in bytes.__rmod__. 2016-04-15 14:11:10 +03:00
Martin Panter cda80940ed Issue #15984: Merge PyUnicode doc from 3.5 2016-04-15 02:27:11 +00:00
Martin Panter 6245cb3c01 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Steven D'Aprano 8ca020e1cc Fix missing parens. 2016-04-15 10:06:18 +10:00
Steven D'Aprano 08fbef040a Improve tests with more modern assert* methods and subTests. 2016-04-15 10:04:24 +10:00
Steven D'Aprano 95702725ff Add secrets module and tests. 2016-04-15 01:51:31 +10:00
Ethan Furman 0fe7978c68 Issue26748: Enum classes should evaluate as True 2016-04-13 23:55:40 -07:00
Ethan Furman de4e079d3d Issue26748: Enum classes should evaluate as True 2016-04-13 23:53:45 -07:00
Ethan Furman 5de67b106a Issue26748: Enum classes should evaluate as True 2016-04-13 23:52:09 -07:00
Serhiy Storchaka 131b8f8eee Issue #26718: super.__init__ no longer leaks memory if called multiple times.
NOTE: A direct call of super.__init__ is not endorsed!
2016-04-13 15:28:53 +03:00
Serhiy Storchaka 3d7497608b Issue #26718: super.__init__ no longer leaks memory if called multiple times.
NOTE: A direct call of super.__init__ is not endorsed!
2016-04-13 15:27:33 +03:00
Martin Panter 0cab9c1eba Issue #26404: Add context manager to socketserver, by Aviv Palivoda 2016-04-13 00:36:52 +00:00
Victor Stinner a07614aa31 Merge 3.5 2016-04-12 18:33:54 +02:00
Victor Stinner c6ec54d8eb Issue #26647: Fix typo in test_grammar
Patch written by Demur Rumed.
2016-04-12 18:33:41 +02:00
Serhiy Storchaka 2940255df2 Issue #26733: Fixed formatting line numbers in test_dis.
Based on patch by Xiang Zhang.
2016-04-12 08:47:08 +03:00
Serhiy Storchaka 247763d64e Issue #26733: Fixed formatting line numbers in test_dis.
Based on patch by Xiang Zhang.
2016-04-12 08:46:28 +03:00
Martin Panter da3bb38452 Issue #26585: Eliminate _quote_html() and use html.escape(quote=False)
Patch by Xiang Zhang.
2016-04-11 00:40:08 +00:00
Martin Panter 50ab1a3694 Issue #26685: Raise OSError if closing a socket fails 2016-04-11 00:38:12 +00:00
Serhiy Storchaka 403002723f Issue #25339: PYTHONIOENCODING now has priority over locale in setting the
error handler for stdin and stdout.
2016-04-10 14:35:21 +03:00
Serhiy Storchaka fc43511867 Issue #25339: PYTHONIOENCODING now has priority over locale in setting the
error handler for stdin and stdout.
2016-04-10 14:34:13 +03:00
Martin Panter cfff15d274 Issue #26712: Merge string_tests cleanup from 3.5 2016-04-10 09:16:23 +00:00
Martin Panter 731b1b12b8 Remove relics of str8 (became bytes) and buffer (bytearray) type tests
Remove redundant tests now that str is unicode.
2016-04-10 08:48:51 +00:00
Martin Panter 0d0db6cc1e Issue #26712: Unify (r)split, (l/r)strip tests into string_tests
This eliminates a few redundant test cases.
2016-04-10 08:45:26 +00:00
Martin Panter db3e2bd82d Issue #21069: Merge test_fileno() from 3.5 2016-04-09 14:05:19 +00:00
Martin Panter d979b2cfcf Issue #21069: Move test_fileno() from test_urllibnet and rewrite it
* No longer attempts to close already freed socket file descriptor
* Use socket object to be compatible with Windows
* Do not use a timeout to avoid complication with non-blocking mode
* Use internal localhost server rather than depending on a third party
* Avoid trouble with buffered HTTP data by testing tunnelled CONNECT data
2016-04-09 14:03:17 +00:00
Martin Panter ae197c9392 Issue #26609: Merge HTTP tests from 3.5 2016-04-09 12:51:41 +00:00
Martin Panter fc475a9fa6 Issue #26609: Fix HTTP server tests to request an absolute URL path 2016-04-09 04:56:10 +00:00
Serhiy Storchaka 3c149a6832 Issue #26764: Bacported tests for bytes formatting. 2016-04-15 14:13:37 +03:00
Brett Cannon 5f0507d8ab Issue #26587: Allow .pth files to specify file paths as well as
directories.

Thanks to Wolfgang Langner for the bug report and initial version of
the patch.
2016-04-08 15:04:28 -07:00
Brett Cannon ef0138f421 Issue #26668: Remove the redundant Lib/test/test_importlib/regrtest.py 2016-04-08 12:29:05 -07:00
Brett Cannon 9e080e0e74 Issue #25609: Introduce contextlib.AbstractContextManager and
typing.ContextManager.
2016-04-08 12:15:27 -07:00
Serhiy Storchaka c5b5ba9bda Issue #26709: Fixed Y2038 problem in loading binary PLists. 2016-04-08 15:00:33 +03:00
Serhiy Storchaka 94ad49fabc Issue #26709: Fixed Y2038 problem in loading binary PLists. 2016-04-08 15:00:02 +03:00
Serhiy Storchaka 7155b881f2 Issue #26671: Fixed tests for changed error messages. 2016-04-08 08:48:20 +03:00
Martin Panter 747be0805d Issue #26257: Merge buffer_tests cleanup from 3.5 2016-04-08 00:16:33 +00:00
Martin Panter 152a19c6bd Issue #26257: Eliminate buffer_tests.py and fix ByteArrayAsStringTest
ByteArrayAsStringTest.fixtype() was converting test data to bytes, not byte-
array, therefore many of the test cases inherited in this class were not
actually being run on the bytearray type.

The tests in buffer_tests.py were redundant with methods in string_tests
.MixinStrUnicodeUserStringTest and string_tests.CommonTest. These methods are
now moved into string_tests.BaseTest, where they will also get run for bytes
and bytearray.

This change also moves test_additional_split(), test_additional_rsplit(), and
test_strip() from CommonTest to BaseTest, meaning these tests are now run for
bytes and bytearray. I plan to eliminate redundancies with existing tests in
test_bytes.py soon.
2016-04-06 06:37:17 +00:00
Guido van Rossum 6a2dc1bd03 Merge upstream typing.py changes from 3.5 branch. 2016-04-05 08:35:22 -07:00
Guido van Rossum bd5b9a0742 Many changes from the upstream repo (https://github.com/python/typing).
This syncs to rev 7b43ada77821d23e55e3a4b35f6055a59b9e1ad7 there.

Summary:

- Add typing.DefaultDict (as a generic variant of collections.defaultdict).

- Use collections.Reversible if it exists (only relevant for Python 3.6).

- Revamped generic class behavior to conform to updated PEP 484.

- Improve speed of Generic.__new__.

- Make sure __init__ is called for new Generic instances. Fix issue #26391.

- Refactor async support to be compatible with 3.2, 3.3, 3.4.

- Remove 'io' and 're' from __all__ (they still exist, just not
  included by "import *"). Fix issue #26234.

- Change @overload -- you can now use it outside stubs (you still
  cannot call the decorated function though).
2016-04-05 08:28:52 -07:00
Martin Panter c86c91aab0 Merge typo fixes from 3.5 2016-04-05 06:20:32 +00:00
Martin Panter cc71a795df Fix typos in documentation and comments 2016-04-05 06:19:42 +00:00
Guido van Rossum 16ca06b8cb Add collections.Reversible. Patch by Ivan Levkivskyi. Fixes issue #25987. 2016-04-04 10:59:29 -07:00
Martin Panter 519f91215b Issue #25951: Fix SSLSocket.sendall() to return None, by Aviv Palivoda 2016-04-03 02:12:54 +00:00
Martin Panter 50badad807 Issue #26586: Simple enhancements to BaseHTTPRequestHandler by Xiang Zhang 2016-04-03 01:28:53 +00:00
Martin Panter b93e4b2480 Issue #26586: Merge excessive HTTP header handling from 3.5 2016-04-03 01:28:49 +00:00
Martin Panter acc03195b0 Issue #26586: Handle excessive header fields in http.server, by Xiang Zhang 2016-04-03 00:45:46 +00:00
Victor Stinner 89d3f53aac Merge 3.5 (asyncio) 2016-04-01 21:40:14 +02:00
Victor Stinner 2ba8ece5be asyncio: allow None as wait timeout
Fix GH#325: Allow to pass None as a timeout value to disable timeout logic.

Change written by Andrew Svetlov and merged by Guido van Rossum.
2016-04-01 21:39:09 +02:00
Martin Panter dcfebb32e2 Issue #26676: Add missing XMLPullParser to ElementTree.__all__ 2016-04-01 06:55:55 +00:00
Martin Panter 0fc03186f7 Issue #22854: Merge test fix from 3.5 2016-03-31 21:06:06 +00:00
Martin Panter 3ee147ffbb Issue #22854: Fix logic for skipping test 2016-03-31 21:05:31 +00:00
Martin Panter f810767bd3 Issue #22854: Merge Windows pipe skipping from 3.5 2016-03-31 11:17:08 +00:00
Martin Panter 0950e6aef6 Issue #22854: Skip pipe seek tests on Windows 2016-03-31 10:31:30 +00:00
Martin Panter c0aab1da3b Issue #22854: Skip pipe seekable() tests on Windows 2016-03-31 10:31:30 +00:00
Martin Panter 047f3b7376 Issue #22854: Merge UnsupportedOperation fixes from 3.5 2016-03-31 08:25:59 +00:00
Martin Panter 754aab28ed Issue #22854: Clarify documentation about UnsupportedOperation and add tests
Also change BufferedReader.writable() and BufferedWriter.readable() to always
return False.
2016-03-31 07:21:56 +00:00
Serhiy Storchaka ab0d198c7a Issue #26492: Exhausted iterator of array.array now conforms with the behavior
of iterators of other mutable sequences: it lefts exhausted even if iterated
array is extended.
2016-03-30 21:11:16 +03:00
Serhiy Storchaka f39c0ac62f Issue #26492: Added additional tests for exhausted iterators of mutable sequences. 2016-03-30 21:01:45 +03:00
Serhiy Storchaka 8dc2ec1513 Issue #26492: Added additional tests for exhausted iterators of mutable sequences. 2016-03-30 21:01:26 +03:00
Serhiy Storchaka ab479c49d3 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka fbb1c5ee06 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Victor Stinner 8a34d416ba Issue #26295: Enhanc test_regrtest.test_tools_script_run_tests()
Pass all regrtest options, not only --testdir.
2016-03-30 08:51:15 +02:00
Victor Stinner 732599f793 Issue #26295: Fix test_regrtest.test_tools_buildbot_test()
Pass also --testdir option.
2016-03-30 08:38:05 +02:00
Victor Stinner d6e2502624 Issue #26295: test_regrtest now uses a temporary directory
test_forever() stores its state into the builtins module since the test module
is reloaded at each run.

Remove also warning to detect leaked tests of a previous run.
2016-03-30 02:33:52 +02:00
Victor Stinner 9759dd3343 Issue #26295: When using "python3 -m test --testdir=TESTDIR", regrtest doesn't
add "test." prefix to test module names.

regrtest also prepends testdir to sys.path.
2016-03-30 02:32:52 +02:00
Victor Stinner 7f24a98a9a Merge 3.5 (test_urllibnet) 2016-03-30 02:20:34 +02:00
Victor Stinner 53f8ba52e6 test_urllibnet: set timeout on test_fileno()
Use the default timeout of 30 seconds to avoid blocking forever.
2016-03-30 02:19:01 +02:00
Victor Stinner 8a96389d47 Merge 3.5 (regrtest) 2016-03-29 13:34:06 +02:00
Victor Stinner 8ba2083e0e Issue #26643: Add missing shutil resources to regrtest.py 2016-03-29 13:33:35 +02:00
Victor Stinner 80ec58c497 fix typo in comment
Thanks Arfrever for the report :)
2016-03-29 09:50:18 +02:00
Martin Panter ef4bb1e994 Issue #23804: Merge SSL zero read fix from 3.5 2016-03-28 01:09:13 +00:00
Martin Panter f6b1d66a3c Issue #23804: Fix SSL recv/read(0) to not return 1024 bytes 2016-03-28 00:22:09 +00:00
Victor Stinner 622583e9bf regrtest: round final timing towards +inf 2016-03-27 18:28:15 +02:00
Martin Panter afd465d497 Issue #26644: Merge SSL negative read fix from 3.5 2016-03-27 10:40:22 +00:00
Martin Panter 5503d4731e Issue #26644: Raise ValueError for negative SSLSocket.recv() and read() 2016-03-27 05:35:19 +00:00
Martin Panter 3840b2ac67 Issue #25940: Use internal local server more in test_ssl
Move many tests from NetworkedTests and NetworkedBIOTests to a new Simple-
BackgroundTests class, using the existing ThreadedEchoServer and SIGNED_
CERTFILE infrastructure.

For tests that cause the server to crash by rejecting its certificate,
separate them into independent test methods.

Added custom root certificate to capath with the following commands:

cp Lib/test/{pycacert.pem,capath/}
# Edit copy to remove part before certificate
c_rehash -v Lib/test/capath/
c_rehash -v -old Lib/test/capath/
# Note the generated file names
cp Lib/test/capath/{pycacert.pem,b1930218.0}
mv Lib/test/capath/{pycacert.pem,ceff1710.0}

Change to pure PEM version of SIGNING_CA because PEM_cert_to_DER_cert() does
not like the extra text at the start.

Moved test_connect_ex_error() into BasicSocketTests and rewrote it to connect
to a reserved localhost port.

NetworkedTests.test_get_server_certificate_ipv6() split out because it needs
to connect to an IPv6 DNS address.

The only reference left to self-signed.pythontest.net is test_timeout_
connect_ex(), which needs a remote server to reliably time out the
connection, but does not rely on the server running SSL.

Made ThreadedEchoServer call unwrap() by default when it sees the client has
shut the connection down, so that the client can cleanly call unwrap().
2016-03-27 01:53:46 +00:00
Victor Stinner 53b0a41d31 Issue #25911: more info on test_os failure 2016-03-26 01:12:36 +01:00
Victor Stinner e984eb501b Fix test_os.test_symlink(): remove create symlink 2016-03-25 22:51:17 +01:00
Alexander Belopolsky 16b698b095 merge 2016-03-25 15:46:55 -04:00
Alexander Belopolsky 1dcf4f9ee5 Issue#26616:Fixed a bug in datetime.astimezone() method. 2016-03-25 15:42:59 -04:00
Victor Stinner d7ac00e620 Backed out changeset 245a16f33c4b
Serhiy asked me to review it.
2016-03-25 19:13:06 +01:00
Victor Stinner ba8cf10873 Rework libregrtest.save_env
* Replace get/restore methods with a Resource class and Resource subclasses
* Create ModuleAttr, ModuleAttrList and ModuleAttrDict helper classes
* Use __subclasses__() to get resource classes instead of using an hardcoded
  list (2 shutil resources were missinged in the list!)
* Don't define MultiprocessingProcessDangling resource if the multiprocessing
  module is missing
* Nicer diff for dictionaries. Useful for the big os.environ dict
* Reorder code to group resources
2016-03-25 17:36:33 +01:00
Victor Stinner 32830149d8 changeset: 100749:0b61b2d28a07
tag: tip
parent: 100742:ebae81b31cf6
user: Victor Stinner <victor.stinner@gmail.com>
date: Fri Mar 25 15:03:34 2016 +0100
files: Lib/test/test_os.py
description:
test_os: Win32ErrorTests checks if file exists

Don't use os.path.exists() since it ignores *any* OSError.
2016-03-25 15:12:08 +01:00
Victor Stinner 931602a1ac test_doctest: remove unused imports 2016-03-25 12:48:17 +01:00
Victor Stinner bdc337b7a8 test_venv: enhance test_devnull() 2016-03-25 12:30:40 +01:00
Victor Stinner b347788b82 Skip test_venv.test_with_pip() if ctypes miss
Issue #26610.
2016-03-25 12:27:02 +01:00
Victor Stinner e77c974357 test_os: Win32ErrorTests now ensures that TESTFN doesn't exist
Replace also other open(filename, "w") with open(filename, "x") to fail if a
previous test forgot to remove filename.
2016-03-25 10:28:23 +01:00
Victor Stinner 6c45d397a3 Issue #21925: Fix test_warnings for release mode
Use -Wd comment line option to log the ResourceWarning.
2016-03-25 09:51:14 +01:00
Victor Stinner 8a20851010 Issue #25654:
* multiprocessing: open file with closefd=False to avoid ResourceWarning
* _test_multiprocessing: open file with O_EXCL to detect bugs in tests (if a
  previous test forgot to remove TESTFN)
* test_sys_exit(): remove TESTFN after each loop iteration

Initial patch written by Serhiy Storchaka.
2016-03-25 09:29:50 +01:00
Victor Stinner 540a81c720 Issue #21925: Fix test_warnings for release mode
Use -Wd comment line option to log the ResourceWarning.
2016-03-25 09:51:14 +01:00
Victor Stinner a6d865c128 Issue #25654:
* multiprocessing: open file with closefd=False to avoid ResourceWarning
* _test_multiprocessing: open file with O_EXCL to detect bugs in tests (if a
  previous test forgot to remove TESTFN)
* test_sys_exit(): remove TESTFN after each loop iteration

Initial patch written by Serhiy Storchaka.
2016-03-25 09:29:50 +01:00
Victor Stinner 47b4557679 test_io: ignore DeprecationWarning on bytes path on Windows 2016-03-25 09:07:07 +01:00
Victor Stinner 633ebda3ba Issue #26637: Fix test_io
The import machinery now raises a different exception when it fails at Python
shutdown.
2016-03-25 08:57:16 +01:00
Victor Stinner e091d32a7a Merge 3.5
Issue #21925: warnings.formatwarning() now catches exceptions when calling
linecache.getline() and tracemalloc.get_object_traceback() to be able to log
ResourceWarning emitted late during the Python shutdown process.
2016-03-25 00:33:12 +01:00
Victor Stinner 27461683a9 warnings.formatwarning(): catch exceptions
Issue #21925: warnings.formatwarning() now catches exceptions on
linecache.getline(...) to be able to log ResourceWarning emitted late during
the Python shutdown process.
2016-03-25 00:30:32 +01:00
Victor Stinner e0511e797c Fix test_warnings.test_improper_option()
test_warnings: only run test_improper_option() and test_warnings_bootstrap()
once. The unit test doesn't depend on self.module.
2016-03-25 00:28:56 +01:00
Victor Stinner 3aac0adfe0 Cleanup regrtest "main()" function
* Rename libregrtest.main_in_temp_cwd() to libregrtest.main()
* Add regrtest.main_in_temp_cwd() alias to libregrtest.main()
* Move old main_in_temp_cwd() code into libregrtest.Regrtest.main()
* Update multiple scripts to call libregrtest.main()
2016-03-24 17:53:20 +01:00
Victor Stinner 4ffcc3ee1e Cleanup regrtest.py
* Move code into a new _main() function
* Fix loop to cleanup sys.path
* Remove unused import
2016-03-24 17:43:53 +01:00
Victor Stinner e40390473d support.temp_dir(): call support.rmtree() instead of shutil.rmtree() 2016-03-24 17:42:10 +01:00
Victor Stinner 3899b549e3 test_os: use support.rmtree() to cleanup WalkTests 2016-03-24 17:21:17 +01:00
Victor Stinner ae39d236b4 Enhance and modernize test_os
* add create_file() helper function
* create files using "x" mode instead of "w" to detect when a previous test
  forget to remove a file
* open file for writing in unbuferred mode (buffering=0)
* replace "try/finally: unlink" with self.addCleanup(support.unlink)
* register unlink cleanup function *before* creating new files
2016-03-24 17:12:55 +01:00
Victor Stinner f95a19b900 test_os: use @support.requires_linux_version 2016-03-24 16:50:41 +01:00
Victor Stinner bc6b72ed06 Closes #26620: Fix ResourceWarning in test_urllib2_localnet
* Use context manager on urllib objects to ensure that they are closed on error
* Use self.addCleanup() to cleanup resources even if a test is interrupted
  with CTRL+c
2016-03-24 13:55:58 +01:00
Victor Stinner e321274b2e Enhance and modernize test_genericpath
* Replace "try/finally: os.remove()" with self.addCleanup(support.unlink) or
  self.addCleanup(support.rmdir): the support function handles the case when
  the file doesn't exist
* Replace "try/finally: f.close()" with "with open(...) as f:"
* test_getsize: add a second test with a different size
* Create file using "x" mode to ensure that the file didn't exist before, to
  detect bugs in tests
* Open files in unbuffered mode (buferring=0) to write immediatly data on disk
* Replace map() with simpler code
* Split isdir() unit test into two units tests to make them less dependant,
  same change for isfile() test
* test_samefile(): test also two different files
2016-03-24 13:44:19 +01:00
Victor Stinner 56db16cd44 regrtest: when parallel tests are interrupted, display progress 2016-03-24 12:04:15 +01:00
Victor Stinner 2b60b7237e regrtest: mention in tests run sequentially or in parallel 2016-03-24 11:55:29 +01:00
Victor Stinner 5de16e80c1 regrtest: fix --fromfile feature
* Update code for the name regrtest output format.
* Enhance also test_regrtest test on --fromfile
2016-03-24 09:43:00 +01:00
Victor Stinner 923590e397 Fix DeprecationWarning on Windows
Issue #25911: Use support.check_warnings() to expect or ignore
DeprecationWarning in test_os.
2016-03-24 09:11:48 +01:00
Victor Stinner 0069aef51a Fix test_spwd on OpenIndiana
Issue #18787: restore "bin" name in test_spwd but catch KeyError.
2016-03-23 21:15:55 +01:00
Victor Stinner c53195bbf0 Try to fix test_gdb on s390x SLES 3.x
Ignore empty lines in stderr.
2016-03-23 21:08:25 +01:00
Stefan Krah 1129084ebd Issue #26621: Remove unnecessary test. 2016-03-23 20:53:22 +01:00
Stefan Krah 66e9d03bf4 Issue #26621: Update libmpdec version and remove unnecessary test case. 2016-03-23 20:50:10 +01:00
Victor Stinner 4a1c7d2c36 Try to fix test_spwd on OpenIndiana
Issue #18787: try to get the "root" entry which should exist on all UNIX
instead of "bin" which doesn't exist on OpenIndiana.
2016-03-23 18:45:55 +01:00
Victor Stinner 904f5def5c Try to fix test_gdb on s390x buildbots 2016-03-23 18:32:54 +01:00
Victor Stinner 412a5e7e23 faulthandler: only log fatal exceptions
Issue #23848, #26622:

* faulthandler now only logs fatal Windows exceptions.
* write error code as decimal, not as hexadecimal
* replace "Windows exception" with "Windows fatal exception"
2016-03-23 14:44:14 +01:00
Victor Stinner 69649f21f0 regrtest: display test duration in sequential mode
Only display duration if a test takes more than 30 seconds.
2016-03-23 12:14:10 +01:00
Victor Stinner 404cdc5a92 faulthandler: add Windows exception handler
Issue #23848: On Windows, faulthandler.enable() now also installs an exception
handler to dump the traceback of all Python threads on any Windows exception,
not only on UNIX signals (SIGSEGV, SIGFPE, SIGABRT).
2016-03-23 10:39:17 +01:00
Victor Stinner 6d7f4f6675 regrtest: add timeout to main process when using -jN
libregrtest: add a watchdog to run_tests_multiprocess() using
faulthandler.dump_traceback_later().
2016-03-23 02:04:32 +01:00
Victor Stinner f9a71153e9 Issue #26588: remove debug traces from _tracemalloc. 2016-03-22 23:54:42 +01:00
Victor Stinner 92c21d7a7c Issue #26588: skip test_warnings.test_tracemalloc() 2016-03-22 21:26:31 +01:00
Victor Stinner 84aab09421 Issue #26588: add debug traces
Try to debug random failure on buildbots.
2016-03-22 16:13:31 +01:00
Victor Stinner 24f949e10c regrtest: add time to output
Timestamps should help to debug slow buildbots, and timeout and hang on
buildbots.
2016-03-22 15:14:09 +01:00
Victor Stinner 10b73e1748 Add C functions _PyTraceMalloc_Track()
Issue #26530:

* Add C functions _PyTraceMalloc_Track() and _PyTraceMalloc_Untrack() to track
  memory blocks using the tracemalloc module.
* Add _PyTraceMalloc_GetTraceback() to get the traceback of an object.
2016-03-22 13:39:05 +01:00
Victor Stinner e492ae50e2 tracemalloc now supports domains
Issue #26588:

* The _tracemalloc now supports tracing memory allocations of multiple address
  spaces (domains).
* Add domain parameter to tracemalloc_add_trace() and
  tracemalloc_remove_trace().
* tracemalloc_add_trace() now starts by removing the previous trace, if any.
* _tracemalloc._get_traces() now returns a list of (domain, size,
  traceback_frames): the domain is new.
* Add tracemalloc.DomainFilter
* tracemalloc.Filter: add an optional domain parameter to the constructor and a
  domain attribute
* Sublte change: use Py_uintptr_t rather than void* in the traces key.
* Add tracemalloc_config.use_domain, currently hardcoded to 1
2016-03-22 12:58:23 +01:00
Serhiy Storchaka e431d3c9aa Issue #26581: Use the first coding cookie on a line, not the last one. 2016-03-20 23:36:29 +02:00
Serhiy Storchaka 97eee1cfda Added new tests for detecting Python source code encoding. 2016-03-20 22:29:40 +02:00
Berker Peksag e2021f2ecd Issue #12813: uuid.uuid4() no longer depends on ctypes
uuid.uuid4() always uses os.urandom() after 756d040aa8e8.
2016-03-20 17:29:56 +02:00
Berker Peksag e3385b4e3d Issue #19265: Improve test coverage of datetime.tzinfo
Without the patch, line 1010 of Lib/datetime.py wasn't covered
by the test suite.

Patch by Colin Williams.
2016-03-19 13:16:32 +02:00
Victor Stinner e0b75b7e87 Fix test_ssl.test_refcycle()
Issue #26590: support.check_warnings() stores warnins, but ResourceWarning now
comes with a reference to the socket object which indirectly keeps the socket
alive.
2016-03-21 17:26:04 +01:00
Berker Peksag 1cd4ff6284 Issue #26560: Avoid potential ValueError in BaseHandler.start_response
Initial patch by Peter Inglesby.
2016-03-19 09:04:59 +02:00
Serhiy Storchaka a051bf3afb Issue #26581: Use the first coding cookie on a line, not the last one. 2016-03-20 23:47:48 +02:00
Serhiy Storchaka fc6990d382 Issues #25643, #26581: Added new tests for detecting Python source code encoding. 2016-03-20 23:12:00 +02:00
Berker Peksag bd5b1a613b Issue #12813: uuid.uuid4() no longer depends on ctypes
uuid.uuid4() always uses os.urandom() after 756d040aa8e8.
2016-03-20 17:30:25 +02:00
Berker Peksag 02cce69217 Issue #19265: Improve test coverage of datetime.tzinfo
Without the patch, line 1010 of Lib/datetime.py wasn't covered
by the test suite.

Patch by Colin Williams.
2016-03-19 13:16:52 +02:00
Berker Peksag 3c3d7f4b99 Issue #18787: spwd.getspnam() now raises a PermissionError if the user
doesn't have privileges.
2016-03-19 11:44:17 +02:00
Victor Stinner 74879e4179 Try again to fix test_warnings on Windows
Issue #26567: normalize newlines in test_tracemalloc.
2016-03-19 10:00:08 +01:00
Berker Peksag cf934a1c9b Issue #26560: Avoid potential ValueError in BaseHandler.start_response
Initial patch by Peter Inglesby.
2016-03-19 09:05:59 +02:00
Victor Stinner bfab932971 Try to fix test_warnings on Windows
Issue #26567.
2016-03-19 02:51:45 +01:00
Victor Stinner 914cde89d4 On ResourceWarning, log traceback where the object was allocated
Issue #26567:

* Add a new function PyErr_ResourceWarning() function to pass the destroyed
  object
* Add a source attribute to warnings.WarningMessage
* Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where
  source object was allocated.
2016-03-19 01:03:51 +01:00
Victor Stinner 1231a4615f Add _showwarnmsg() and _formatwarnmsg() to warnings
Issue #26568: add new  _showwarnmsg() and _formatwarnmsg() functions to the
warnings module.

The C function warn_explicit() now calls warnings._showwarnmsg() with a
warnings.WarningMessage as parameter, instead of calling warnings.showwarning()
with multiple parameters.

_showwarnmsg() calls warnings.showwarning() if warnings.showwarning() was
replaced. Same for _formatwarnmsg(): call warnings.formatwarning() if it was
replaced.
2016-03-19 00:47:17 +01:00
Ned Deily c9188000d7 Issue #26583: merge from 3.5 2016-03-17 17:56:42 -04:00
Ned Deily 1c80b152bd Issue #26583: Skip test_timestamp_overflow in test_import if bytecode
files cannot be written.
2016-03-17 17:53:52 -04:00
Martin Panter ce911c3fed Issue #26499: Fixes to HTTPResponse.readline() and read1(), by Silent Ghost 2016-03-17 06:42:48 +00:00
Victor Stinner 861d9abfcf faulthandler now works in non-Python threads
Issue #26563:

* Add _PyGILState_GetInterpreterStateUnsafe() function: the single
  PyInterpreterState used by this process' GILState implementation.
* Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from
  autoInterpreterState in last resort. The function now accepts NULL for interp
  and current_tstate parameters.
* test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
2016-03-16 22:45:24 +01:00
Victor Stinner ad524375af Fail if PyMem_Malloc() is called without holding the GIL
Issue #26563: Debug hooks on Python memory allocators now raise a fatal error
if functions of the PyMem_Malloc() family are called without holding the GIL.
2016-03-16 12:12:53 +01:00
Martin Panter ec195fba5b Issue #26499: Merge HTTPResponse fix from 3.5 2016-03-17 07:05:34 +00:00
Victor Stinner 82f04e2dfd regrtest: Fix module.__path__
Issue #26538: libregrtest: Fix setup_tests() to keep module.__path__ type
(_NamespacePath), don't convert to a list.

Add _NamespacePath.__setitem__() method to importlib._bootstrap_external.
2016-03-15 23:08:44 +01:00
Victor Stinner 6453e9ed0a Issue #26564: Fix test_capi 2016-03-15 23:36:28 +01:00
Victor Stinner b380010782 Merge 3.5 (test_faulthandler) 2016-03-15 17:24:13 +01:00
Victor Stinner 57003f81ea faulthandler: Test Py_FatalError() with GIL released
Issue #26558.
2016-03-15 17:23:35 +01:00
Victor Stinner 32eb840a42 Issue #26566: Rewrite test_signal.InterProcessSignalTests
* Add Lib/test/signalinterproctester.py
* Don't disable the garbage collector anymore
* Don't use os.fork() with a subprocess to not inherit existing signal handlers
  or threads: start from a fresh process
* Don't use UNIX kill command to send a signal but Python os.kill()
* Use a timeout of 10 seconds to wait for the signal instead of 1 second
* Always use signal.pause(), instead of time.wait(1), to wait for a signal
* Use context manager on subprocess.Popen
* remove code to retry on EINTR: it's no more needed since the PEP 475
* remove unused function exit_subprocess()
* Cleanup the code
2016-03-15 11:12:35 +01:00
Antoine Pitrou 58f2bd86fb Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. 2016-03-15 10:52:51 +01:00
Antoine Pitrou 62b6a0d70c Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. 2016-03-15 10:48:28 +01:00
Victor Stinner c4aec3628b Check the GIL in PyObject_Malloc()
Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is
held when the function is called.
2016-03-14 22:26:53 +01:00
Victor Stinner 08572f68a9 Issue #26516: Fix test_capi on AIX
Fix regex for parse a pointer address.
2016-03-14 21:55:43 +01:00
Victor Stinner 0ab7d0978b Merge 3.5 (test_venv) 2016-03-14 18:22:12 +01:00
Victor Stinner 87d6e1364c Fix test_venv on FreeBSD buildbot
Ignore pip warning in test_venv.test_with_venv().
2016-03-14 18:21:58 +01:00
Victor Stinner 3719779765 Merge 3.5 (test_site) 2016-03-14 17:47:30 +01:00
Victor Stinner 21d0e1b5fc Skip test_site if USER_SITE cannot be created
Issue #17758: Skip test_site if site.USER_SITE directory doesn't exist and
cannot be created.
2016-03-14 17:47:03 +01:00
Victor Stinner b3adb1adeb Issue #26516: Fix test_capi on 32-bit system
On 32-bit system, only 4 bytes after dumped for the tail.
2016-03-14 17:40:09 +01:00
Victor Stinner a1bc28a91d Issue #26516: Fix test_capi on Windows
Pointers are formatted differently.
2016-03-14 17:10:36 +01:00
Victor Stinner 34be807ca4 Add PYTHONMALLOC env var
Issue #26516:

* Add PYTHONMALLOC environment variable to set the Python memory
  allocators and/or install debug hooks.
* PyMem_SetupDebugHooks() can now also be used on Python compiled in release
  mode.
* The PYTHONMALLOCSTATS environment variable can now also be used on Python
  compiled in release mode. It now has no effect if set to an empty string.
* In debug mode, debug hooks are now also installed on Python memory allocators
  when Python is configured without pymalloc.
2016-03-14 12:04:26 +01:00
Serhiy Storchaka c877658d1f Issue #20556: Used specific assert methods in threading tests. 2016-03-14 10:40:14 +02:00
Serhiy Storchaka 8c0f0c5c1e Issue #20556: Used specific assert methods in threading tests. 2016-03-14 10:28:59 +02:00
Berker Peksag 04bc5b9e48 Issue #747320: Use email.utils.formatdate() to avoid code duplication
in BaseHTTPRequestHandler

Initial patch by karlcow.
2016-03-14 06:06:03 +02:00
Berker Peksag 0647ef05eb Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR 2016-03-14 05:48:28 +02:00
Berker Peksag 20be53e5b5 Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR 2016-03-14 05:48:02 +02:00
Serhiy Storchaka 6e4150f36b Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by
Tamás Bence Gedai.
2016-03-12 10:53:09 +02:00
Serhiy Storchaka 8a7240eeed Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by
Tamás Bence Gedai.
2016-03-12 10:51:16 +02:00
Victor Stinner 15a83e845f Revert change 291d47954618
Revert:
"Always test datetime.strftime("%4Y")

Issue #13305: Always test datetime.datetime.strftime("%4Y") for years < 1900."

In fact, strftime("%4Y") fails on most platforms.
2016-03-12 08:16:48 +01:00
Victor Stinner 25caed546d Merge 3.5 2016-03-11 22:53:15 +01:00
Victor Stinner d7569637b5 Issue #20589: Fix test_pathlib 2016-03-11 22:53:00 +01:00
Victor Stinner 474ebbbe50 Always test datetime.strftime("%4Y")
Issue #13305: Always test datetime.datetime.strftime("%4Y") for years < 1900.
2016-03-11 22:36:14 +01:00
Berker Peksag d0e9b6919f Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
NotImplementedError instead of ImportError.
2016-03-11 23:08:11 +02:00
Berker Peksag 04d4229719 Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise
NotImplementedError instead of ImportError.
2016-03-11 23:07:27 +02:00
Serhiy Storchaka 786e922054 Issue #25911: Tring to silence deprecation warnings in bytes path walk tests. 2016-03-08 21:26:44 +02:00
Serhiy Storchaka ada6db7870 Issue #25911: Tring to silence deprecation warnings in bytes path walk tests. 2016-03-08 21:26:26 +02:00
Serhiy Storchaka 706379ae0d Backed out changeset da020e408c7f 2016-03-08 21:16:47 +02:00
Serhiy Storchaka 7ab61ae8aa Backed out changeset f9e22717722d 2016-03-08 21:15:43 +02:00
Serhiy Storchaka adca8464b1 Backed out changeset 19a3e0e664af 2016-03-08 21:13:35 +02:00
Serhiy Storchaka 674e2d0ea0 Issue #15068: Got rid of excessive buffering in fileinput.
The bufsize parameter is now deprecated and ignored.
2016-03-08 18:35:19 +02:00
Serhiy Storchaka cc2dbc5844 Issue #15068: Got rid of excessive buffering in the fileinput module.
The bufsize parameter is no longer used.
2016-03-08 18:28:36 +02:00
Serhiy Storchaka 238fecd75c Issues #23808, #25911: Trying to fix walk tests on Windows.
On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
2016-03-08 16:12:46 +02:00
Serhiy Storchaka 55e3218eee Issues #23808, #25911: Trying to fix walk tests on Windows.
On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
2016-03-08 16:12:09 +02:00
Serhiy Storchaka 388b90f28e Issues #23808, #25911: Trying to fix walk tests on Windows.
On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.
2016-03-08 16:11:26 +02:00
Raymond Hettinger 20b3e72b8d Merge 2016-03-06 18:12:08 -08:00
Raymond Hettinger e525ee3b48 Document another recipe for itertools: all_equal(). Inspired by David Beazley. 2016-03-06 18:11:38 -08:00
Alexander Belopolsky a2998a63c8 Closes #19475: Added timespec to the datetime.isoformat() method.
Added an optional argument timespec to the datetime isoformat() method
to choose the precision of the time component.

Original patch by Alessandro Cucci.
2016-03-06 14:58:43 -05:00
Berker Peksag d07a1cb53b Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py
Patch by Guo Ci Teo.
2016-03-06 16:50:44 +02:00
Berker Peksag d66dd5ce68 Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py
Patch by Guo Ci Teo.
2016-03-06 16:50:15 +02:00
Berker Peksag 48238c7e37 Issue #2202: Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls
Raise ValueError if algorithm is not MD5 or SHA.

Initial patch by Mathieu Dupuy.
2016-03-06 16:17:47 +02:00
Berker Peksag e88dd1c32c Issue #2202: Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls
Raise ValueError if algorithm is not MD5 or SHA.

Initial patch by Mathieu Dupuy.
2016-03-06 16:16:40 +02:00
Serhiy Storchaka 8cc859c103 Issue #26167: Backported copy tests. 2016-03-06 15:03:07 +02:00
Serhiy Storchaka 818e18dd94 Issue #26167: Minimized overhead in copy.copy() and copy.deepcopy().
Optimized copying and deepcopying bytearrays, NotImplemented, slices,
short lists, tuples, dicts, sets.
2016-03-06 14:56:57 +02:00
Serhiy Storchaka de128e19e2 Issue #26015: Added new tests for pickling iterators of mutable sequences. 2016-03-06 14:12:04 +02:00
Serhiy Storchaka aabafe7bc2 Issue #26015: Added new tests for pickling iterators of mutable sequences. 2016-03-06 14:10:24 +02:00
Serhiy Storchaka 5608411a96 Issue #25718: Fixed pickling and copying the accumulate() iterator with total is None. 2016-03-06 14:02:26 +02:00
Serhiy Storchaka d55162517d Issue #25718: Fixed pickling and copying the accumulate() iterator with total is None. 2016-03-06 14:00:45 +02:00
Serhiy Storchaka a0d416f0d1 Issue #26482: Allowed pickling recursive dequeues. 2016-03-06 08:55:21 +02:00
Serhiy Storchaka 96c058b4de Fixed typo in pickle tests. 2016-03-04 09:40:03 +02:00
Serhiy Storchaka be70002866 Fixed typo in pickle tests. 2016-03-04 09:39:47 +02:00
Benjamin Peterson 0f04bc7959 merge 3.5 (closes #26478) 2016-03-03 22:10:52 -08:00
Benjamin Peterson cfc2a1fc70 merge 3.4 (closes #26478) 2016-03-03 22:08:01 -08:00
Benjamin Peterson f11b25b081 properly use the ObjArgs variant of CallMethod in dictview binary operations (closes #26478) 2016-03-03 22:05:36 -08:00
Berker Peksag 6282e656e9 Issue #26335: Make mmap.write() return the number of bytes written like
other write methods.

Patch by Jakub Stasiak.
2016-03-02 19:30:18 +02:00
Yury Selivanov d2dc15b26b Merge 3.5 (issue #25888) 2016-03-02 11:31:06 -05:00
Yury Selivanov c724bae51c coroutines: Error when awaiting on coroutine that's being awaited
Issue #25888
2016-03-02 11:30:46 -05:00
Yury Selivanov 5604446b3b Merge 3.5 (issue #26338) 2016-03-02 11:17:18 -05:00
Yury Selivanov e076ffb068 asyncio: Remove duplicate bind addresses in create_server.
Patch by Sebastien Bourdeauducq (issue #26338)
2016-03-02 11:17:01 -05:00
Yury Selivanov 06495ffe93 Merge 3.5 (issue #26347) 2016-03-02 11:08:05 -05:00
Yury Selivanov f9e1f2bda9 inspect: Fix BoundArguments.apply_defaults to handle empty arguments
Patch by Frederick Wagner (issue #26347)
2016-03-02 11:07:47 -05:00
Yury Selivanov a8ac8e336b Merge 3.5 (issue #26221) 2016-03-02 11:03:53 -05:00
Yury Selivanov 1bd030788d asyncio: Prevent StopIteration from being thrown into a Future
Patch by Chris Angelico (issue #26221)
2016-03-02 11:03:28 -05:00
Yury Selivanov 578bc5b80b Merge 3.5 (issue #25647) 2016-03-02 10:49:36 -05:00
Yury Selivanov dce63234c5 asyncio: Fix @coroutine to recognize CoroWrapper (issue #25647)
Patch by Vladimir Rutsky.
2016-03-02 10:49:16 -05:00
Yury Selivanov 45c84cc0ca Merge 3.5 2016-03-02 10:41:51 -05:00
Yury Selivanov 0c6a34409e asyncio, selectors: Update to the upstream version 2016-03-02 10:37:59 -05:00
Yury Selivanov 90faa09152 asyncio: Update 3.4 asyncio/test_tasks to upstream version 2016-03-02 10:33:22 -05:00
Victor Stinner f2192855dd Merge 3.5 2016-03-01 22:07:53 +01:00
Victor Stinner 337986740f Issue #26464: Fix unicode_fast_translate() again
Initialize i variable if the string is non-ASCII.
2016-03-01 21:59:58 +01:00
Victor Stinner 3d9d77a3dc Merge 3.5 2016-03-01 21:30:50 +01:00
Victor Stinner 6c9aa8f2bf Fix str.translate()
Issue #26464: Fix str.translate() when string is ASCII and first replacements
removes character, but next replacement uses a non-ASCII character or a string
longer than 1 character. Regression introduced in Python 3.5.0.
2016-03-01 21:30:30 +01:00
Serhiy Storchaka 42e49ac0da Issue #26457: Fixed the subnets() methods in IP network classes for the case
when resulting prefix length is equal to maximal prefix length.
Based on patch by Xiang Zhang.
2016-03-01 10:26:10 +02:00
Serhiy Storchaka bb0dbd583b Issue #26457: Fixed the subnets() methods in IP network classes for the case
when resulting prefix length is equal to maximal prefix length.
Based on patch by Xiang Zhang.
2016-03-01 10:25:45 +02:00
Martin Panter 93088d1b03 Issue #26385: Merge NamedTemporaryFile fix from 3.5 2016-02-29 11:25:09 +00:00
Martin Panter 7869a22779 Issue #26385: Cleanup NamedTemporaryFile if open() fails, by SilentGhost 2016-02-28 05:22:20 +00:00
Martin Panter 8cacc63002 Issue #22836: Merge exception reporting from 3.5 2016-02-28 03:29:51 +00:00
Martin Panter 3263f6874a Issue #22836: Keep exception reports sensible despite errors 2016-02-28 03:16:11 +00:00
Martin Panter de9b27d908 Issue #26390: Merge pbkdf2_hmac() doc from 3.5 2016-02-26 00:41:38 +00:00
Martin Panter 6e132254a9 Issue #26402: Merge XML-RPC client fix from 3.5 2016-02-25 12:13:50 +00:00
Martin Panter eae3336e42 Issue #26402: Fix XML-RPC client retrying after server disconnection
This is a regression introduced in 3.5 by revision eba80326ba53. Fix by Jelte
Fennema, test case by me.
2016-02-25 11:53:40 +00:00
Serhiy Storchaka f799ca82a0 Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
2016-02-25 13:16:02 +02:00
Serhiy Storchaka f828218d65 Issue #25801: Fixed resource warnings in test_zipfile64.
Patch by SilentGhost.
2016-02-25 12:55:19 +02:00
Jason R. Coombs b118870490 Issue #26302: merge from 3.5 2016-02-24 08:50:59 -05:00
Serhiy Storchaka 6c783ac15d Issue #25913: Leading <~ is optional now in base64.a85decode() with adobe=True.
Patch by Swati Jaiswal.
2016-02-24 12:08:11 +02:00
Serhiy Storchaka 205e75bb62 Issue #25913: Leading <~ is optional now in base64.a85decode() with adobe=True.
Patch by Swati Jaiswal.
2016-02-24 12:05:50 +02:00
Martin Panter 510addf63f Issue #5824: Merge socketserver tests from 3.5 2016-02-24 06:14:15 +00:00
Martin Panter 1827eff030 Issue #5824: Fix DatagramRequestHandler tests by binding the client socket 2016-02-24 05:12:59 +00:00
Martin Panter 150ea1a1df Issue #22088: Merge base64 docs from 3.5 2016-02-24 01:08:43 +00:00
Martin Panter ee3074e1f4 Issue #22088: Clarify base-64 alphabets and which characters are discarded
* There are only two base-64 alphabets defined by the RFCs, not three
* Due to the internal translation, plus (+) and slash (/) are never discarded
* standard_ and urlsafe_b64decode() discard characters as well

Also update the doc strings to clarify data types, based on revision
92760d2edc9e, correct the exception raised by b16decode(), and correct the
parameter name for the base-85 functions.
2016-02-23 22:30:50 +00:00
Martin Panter bc85e35fe6 Issue #26390: Fix and test pbkdf2_hmac() parameter names
Based on patch by Daan Bakker.
2016-02-22 09:21:49 +00:00
Martin Panter d9108d1253 Issue #23430: Stop socketserver from catching SystemExit etc from handlers
Also make handle_error() consistently output to stderr, and fix the
documentation.
2016-02-21 08:49:56 +00:00
Brett Cannon e5f4d3c246 Merge for issue #26186 2016-02-20 18:37:04 -08:00
Brett Cannon 558823a0cf Issue #26186: Remove an invalid type check in
importlib.util.LazyLoader.

The class was checking its argument as to whether its implementation
of create_module() came directly from importlib.abc.Loader. The
problem is that the classes coming from imoprtlib.machinery do not
directly inherit from the ABC as they come from _frozen_importlib.
Because the documentation has always said that create_module() was
ignored, the check has simply been removed.
2016-02-20 18:35:41 -08:00
Brett Cannon 0911c0d271 Merge for issue #26367 2016-02-20 12:59:36 -08:00
Brett Cannon 4f38cb41fe Issue #26367: Have importlib.__init__() raise RuntimeError when
'level' is specified but no __package__.

This brings the function inline with builtins.__import__(). Thanks to
Manuel Jacob for the patch.
2016-02-20 12:52:06 -08:00
Martin Panter 4ddbc0784a Issue #26309: Merge socketserver fix from 3.5 2016-02-19 02:38:34 +00:00
Martin Panter 4bf427495f Issue #26309: Rewrite test in main thread and avoid race condition 2016-02-19 02:16:42 +00:00
Berker Peksag 31a252b7f3 Issue #16915: Clarify that mode parameter of socket.makefile() does not accept
the same values as open().
2016-02-18 17:34:32 +02:00
Berker Peksag 3fe64d0c5c Issue #16915: Clarify that mode parameter of socket.makefile() does not accept
the same values as open().
2016-02-18 17:34:00 +02:00
Martin Panter a2b64e630e Issue #26309: Merge socketserver fix from 3.5 2016-02-18 11:01:32 +00:00
Martin Panter c12fef9aa3 Issue #26309: Shut down socketserver request if verify_request() is false
Patch by Aviv Palivoda.
2016-02-18 10:43:55 +00:00
Yury Selivanov 3e48b38dff Merge 3.5 (issue #25887) 2016-02-13 18:00:31 -05:00
Yury Selivanov 77c96813ab Issue #25887: Raise a RuntimeError when a coroutine is awaited more than once. 2016-02-13 17:59:05 -05:00
Yury Selivanov e0b23095ee Issues #26289 and #26315: Optimize floor/modulo div for single-digit longs
Microbenchmarks show 2-2.5x improvement.  Built-in 'divmod' function
is now also ~10% faster.

-m timeit -s "x=22331" "x//2;x//-3;x//4;x//5;x//-6;x//7;x//8;x//-99;x//100;"
with patch: 0.321          without patch: 0.633

-m timeit -s "x=22331" "x%2;x%3;x%-4;x%5;x%6;x%-7;x%8;x%99;x%-100;"
with patch: 0.224          without patch: 0.66

Big thanks to Serhiy Storchaka, Mark Dickinson and Victor Stinner for
thorow code reviews and algorithms improvements.
2016-02-11 10:26:27 -05:00
Serhiy Storchaka ffe96ae10b Issue #25994: Added the close() method and the support of the context manager
protocol for the os.scandir() iterator.
2016-02-11 13:21:30 +02:00
Serhiy Storchaka 2feb642585 Issue #26325: Added test.support.check_no_resource_warning() to check that
no ResourceWarning is emitted.
2016-02-11 13:12:19 +02:00
Serhiy Storchaka 94a619d48b Issue #26325: Added test.support.check_no_resource_warning() to check that
no ResourceWarning is emitted.
2016-02-11 13:11:44 +02:00
Serhiy Storchaka 885bdc4946 Issue #25985: sys.version_info is now used instead of sys.version
to format short Python version.
2016-02-11 13:10:36 +02:00
Serhiy Storchaka a9725f86a9 Issue #26312: SystemError is now raised in all programming bugs with using
PyArg_ParseTupleAndKeywords().  RuntimeError did raised before in some
programming bugs.
2016-02-11 12:41:40 +02:00
Charles-François Natali 78f55ffc63 Issue #23992: multiprocessing: make MapResult not fail-fast upon exception. 2016-02-10 22:58:18 +00:00
Martin Panter 3008b1c4bb Issue #26304: Merge doc wording from 3.5 2016-02-10 05:44:56 +00:00
Martin Panter c04fb56e36 Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similar
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Martin Panter 7e3a91a5fc Issue #26136: Upgrade the generator_stop warning to DeprecationWarning
Patch by Anish Shah.
2016-02-10 04:40:48 +00:00
Martin Panter 1fe0d13d12 Issue #26243: zlib.compress() keyword argument support by Aviv Palivoda 2016-02-10 10:06:36 +00:00
Victor Stinner 15a3095d64 compiler: don't emit SyntaxWarning on const stmt
Issue #26204: the compiler doesn't emit SyntaxWarning warnings anymore when
constant statements are ignored.
2016-02-08 22:45:06 +01:00
Serhiy Storchaka 896632ea6b Issue #25983: Added tests for multi-argument type(). 2016-02-08 20:28:22 +02:00
Serhiy Storchaka 763f9f0d89 Issue #25983: Added tests for multi-argument type(). 2016-02-08 20:28:03 +02:00
Victor Stinner a2724095cd compiler now ignores constant statements
The compile ignores constant statements and emit a SyntaxWarning warning.

Don't emit the warning for string statement because triple quoted string is a
common syntax for multiline comments.

Don't emit the warning on ellipis neither: 'def f(): ...' is a legit syntax for
abstract functions.

Changes:

* test_ast: ignore SyntaxWarning when compiling test statements. Modify
  test_load_const() to use assignment expressions rather than constant
  expression.
* test_code: add more kinds of constant statements, ignore SyntaxWarning when
  testing that the compiler removes constant statements.
* test_grammar: ignore SyntaxWarning on the statement "1"
2016-02-08 18:17:58 +01:00
Victor Stinner 51d8c526d5 Replace noop constant statement with expression
* Constant statements will be ignored and the compiler will emit a
  SyntaxWarning.
* Replace constant statement (ex: "1") with an expression statement
  (ex: "x=1").
* test_traceback: use context manager on the file.

Issue #26204.
2016-02-08 17:57:02 +01:00
Victor Stinner f089196beb Simplify main() of test_ast
* Use ast.parse() to get the AST for a statement
* Use str%args syntax for format a line

Issue #26204.
2016-02-08 17:15:21 +01:00
Serhiy Storchaka d2962f145a Issue #25949: __dict__ for an OrderedDict instance is now created only when
needed.
2016-02-08 16:39:05 +02:00
Serhiy Storchaka 79ad897052 Issue #25911: Restored support of bytes paths in os.walk() on Windows. 2016-02-08 16:24:15 +02:00
Martin Panter 192697e33b Issue #26045: Merge http.client error addition from 3.5 2016-02-09 11:57:11 +00:00
Martin Panter 44391481d7 Issue #26045: Add UTF-8 suggestion to error in http.client
Based on patch by Guido van Rossum.
2016-02-09 10:20:52 +00:00
Serhiy Storchaka 5f6a0b4eb2 Issue #25911: Restored support of bytes paths in os.walk() on Windows. 2016-02-08 16:23:28 +02:00
Serhiy Storchaka d0c1f7743d Issue #26198: Make datetime error tests more lenient. 2016-02-08 09:26:57 +02:00
Serhiy Storchaka 0c0d537b24 Issue #26198: Make datetime error tests more lenient. 2016-02-08 09:25:53 +02:00
Serhiy Storchaka 4cd63ef67a Issue #26198: ValueError is now raised instead of TypeError on buffer
overflow in parsing "es#" and "et#" format units.  SystemError is now raised
instead of TypeError on programmical error in parsing format string.
2016-02-08 01:22:47 +02:00
Serhiy Storchaka 3e17c788a8 Issue #26198: Fixed error messages for some argument parsing errors. 2016-02-08 01:20:21 +02:00
Serhiy Storchaka c4b813d05d Issue #26198: Fixed error messages for some argument parsing errors.
Fixed the documented about buffer overflow error for "es#" and "et#" format
units.
2016-02-08 01:06:11 +02:00
Serhiy Storchaka 503f908090 Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir().
Patch by Thomas Kluyver.
2016-02-08 00:02:25 +02:00
Anish Shah 102d813b55 Issue #26302: Correctly identify comma as an invalid character for a cookie (correcting regression in Python 3.5). 2016-02-07 05:36:00 +05:00
Eric V. Smith 135d5f49f6 Fix issue 26287: While handling FORMAT_VALUE opcode, the top of stack was being corrupted if an error occurred in PyObject_Format(). 2016-02-05 18:23:08 -05:00
Martin Panter a3643c280f Issue #12923: Merge FancyURLopener fix from 3.5 2016-02-06 01:08:40 +00:00
Yury Selivanov ab8d4fba6d Merge 3.5 2016-02-04 14:08:23 -05:00
Yury Selivanov 46f7785e28 Issue #25660: Fix a unittest and rlcompleter when readline isn't available 2016-02-04 14:00:26 -05:00
Martin Panter a03702252f Issue #12923: Reset FancyURLopener's redirect counter even on exception
Based on patches by Brian Brazil and Daniel Rocco.
2016-02-04 06:01:35 +00:00
Serhiy Storchaka 65aaef423b Issue #25945: Fixed bugs in functools.partial.
Fixed a crash when unpickle the functools.partial object with wrong state.
Fixed a leak in failed functools.partial constructor.
"args" and "keywords" attributes of functools.partial have now always types
tuple and dict correspondingly.
2016-02-02 18:45:47 +02:00
Serhiy Storchaka 3874128519 Issue #25945: Fixed bugs in functools.partial.
Fixed a crash when unpickle the functools.partial object with wrong state.
Fixed a leak in failed functools.partial constructor.
"args" and "keywords" attributes of functools.partial have now always types
tuple and dict correspondingly.
2016-02-02 18:45:17 +02:00
Raymond Hettinger a63897164e merge 2016-02-01 21:21:19 -08:00
Raymond Hettinger b00da57561 Issue #26194: Inserting into a full deque to raise an IndexError 2016-02-01 21:19:22 -08:00
Victor Stinner 58afd2551e Merge 3.5 (test_asyncio) 2016-02-01 12:41:24 +01:00
Martin Panter 7909411964 Issue #19587: Merge test_bytes cleanup from 3.5 2016-02-02 10:54:10 +00:00
Martin Panter 275bd96aa6 Issue #19587: Remove masked and redundant tests in test_bytes
* test_contains() did not override anything
* test_expandtabs/upper/lower() in FixedStringTest were masking usable tests
  in string_tests. These tests now get run for bytearray() and bytes().
* test_expandtabs/upper/lower() in buffer_tests were only run on bytearray()
  and are redundant with string_tests
2016-02-02 10:37:15 +00:00
Martin Panter 9990cb0999 Issue #26173: Merge SSL tests from 3.5 2016-02-01 22:13:43 +00:00
Martin Panter 3464ea2807 Issue #26173: Separate bad cert file tests and client rejection test
Test test_wrong_cert() runs a server that rejects the client's certificate,
so ECONNRESET is reasonable in addition to SSLError. On the other hand, the
other three tests don't even need to run a server because they are just
testing the parsing of invalid certificate files.

Also fix a ResourceWarning by closing the wrapped socket.
2016-02-01 21:58:11 +00:00
Victor Stinner 0df5313458 test_asyncio: fix test_timeout_time()
Accept time delta up to 0.12 second, instead of 0.11, for the "AMD64 FreeBSD
9.x" buildbot slave.
2016-02-01 12:39:50 +01:00
Berker Peksag 396cbd6dfd Issue #23076: Path.glob() now raises a ValueError if it's called with an
invalid pattern.

Patch by Thomas Nyberg.
2016-01-30 17:51:35 +02:00
Berker Peksag 4a208e448e Issue #23076: Path.glob() now raises a ValueError if it's called with an
invalid pattern.

Patch by Thomas Nyberg.
2016-01-30 17:50:48 +02:00
Martin Panter cca32995b3 Issue #4806: Merge * unpacking fix from 3.5 2016-01-31 06:33:16 +00:00
Martin Panter b5944220ab Issue #4806: Avoid masking original TypeError in call with * unpacking
Based on patch by Hagen Fürstenau and Daniel Urban.
2016-01-31 06:30:56 +00:00
Martin Panter 7602b76d47 Issue #26173: Merge wrongcert test from 3.5 2016-01-30 04:45:02 +00:00
Martin Panter 407b62f3e5 Issue #26173: Fix test_ssl confusion with non-existing cert and wrongcert.pem
Testing for a non-existing certificate file is already done in test_errors().
Copy wrongcert.pem from Python 2 and use it to test the behaviour with a
mismatched certificate.
2016-01-30 03:41:43 +00:00
Serhiy Storchaka 2552c2d6f7 Issue #26202: copy.deepcopy() now correctly copies range() objects with
non-atomic attributes.
2016-01-28 21:43:51 +02:00
Serhiy Storchaka 0a20bbf669 Issue #26202: copy.deepcopy() now correctly copies range() objects with
non-atomic attributes.
2016-01-28 21:43:35 +02:00
Serhiy Storchaka b49a1edc15 Merge heads 2016-01-28 19:56:40 +02:00
Serhiy Storchaka d2557a67d8 Issue #26198: Added tests for "es", "et", "es#", "et#" and "C" format units
of PyArg_Parse*() functions.
2016-01-28 19:51:26 +02:00
Serhiy Storchaka c8241fdde7 Issue #26198: Added tests for "es", "et", "es#", "et#" and "C" format units
of PyArg_Parse*() functions.
2016-01-28 19:49:54 +02:00
Victor Stinner 8f475effbc Backport fixes on test_eintr
* Issue #25234: Skip test_eintr.test_open() under OS X to avoid hanging
* Issue #25868: Try to make test_eintr.test_sigwaitinfo() more reliable
  especially on slow buildbots. Use a pipe to synchronize the parent and the
  child processes.
2016-01-28 18:13:45 +01:00
Berker Peksag c661e1d10d Issue #24705: Add a test case for ef84d21f5292 2016-01-28 16:58:23 +02:00
Berker Peksag ad13edb6fd Issue #24705: Add a test case for ef84d21f5292 2016-01-28 16:58:00 +02:00
Raymond Hettinger 0ef0423cb2 merge 2016-01-26 21:46:03 -08:00
Raymond Hettinger 3743432302 Issue #26194: Fix undefined behavior for deque.insert() when len(d) == maxlen 2016-01-26 21:44:16 -08:00
Victor Stinner be59d1489b Issue #26146: enhance ast.Constant error message
Mention the name of the invalid type in error message of AST validation for
constants.

Suggestion made by Joseph Jevnik on a review.
2016-01-27 00:39:12 +01:00
Raymond Hettinger 906d82db6d Fix typo 2016-01-25 23:00:21 -08:00
Victor Stinner f2c1aa1661 Add ast.Constant
Issue #26146: Add a new kind of AST node: ast.Constant. It can be used by
external AST optimizers, but the compiler does not emit directly such node.

An optimizer can replace the following AST nodes with ast.Constant:

* ast.NameConstant: None, False, True
* ast.Num: int, float, complex
* ast.Str: str
* ast.Bytes: bytes
* ast.Tuple if items are constants too: tuple
* frozenset

Update code to accept ast.Constant instead of ast.Num and/or ast.Str:

* compiler
* docstrings
* ast.literal_eval()
* Tools/parser/unparse.py
2016-01-26 00:40:57 +01:00
Victor Stinner 1aa78938b0 Issue #26146: marshal.loads() now uses the empty frozenset singleton 2016-01-23 14:15:48 +01:00
Victor Stinner 5ebe2c89fe Cleanup test_dict
* Write one import per line
* Sort imports by name
* Add an empty line: 2 empty lines between code blocks at the module level (PEP 8)
2016-01-23 13:52:05 +01:00
Victor Stinner 843a1fb1e7 test_gc: remove unused imports 2016-01-23 13:29:02 +01:00
Brett Cannon 9fa812668f Issue #18018: Raise an ImportError if a relative import is attempted
with no known parent package.

Previously SystemError was raised if the parent package didn't exist
(e.g., __package__ was set to '').
Thanks to Florent Xicluna and Yongzhi Pan for reporting the issue.
2016-01-22 16:39:02 -08:00