Commit Graph

39565 Commits

Author SHA1 Message Date
Steven D'Aprano 08fbef040a Improve tests with more modern assert* methods and subTests. 2016-04-15 10:04:24 +10:00
Steven D'Aprano a873f68248 run Tools/reindent.py on secrets.py to satisfy the checkwhitespace hook 2016-04-15 01:55:14 +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
Senthil Kumaran 6fce35354a merge 3.5.
[minor] - Correct the docstring of locale.str. Patch by poleto.
2016-04-12 23:15:44 -07:00
Senthil Kumaran a3c532b0ed [minor] - Correct the docstring of locale.str. Patch by poleto. 2016-04-12 23:14:14 -07: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
Victor Stinner 7e50978a4e Issue #26647: Cleanup modulefinder
Use directly dis.opmap[name] rather than dis.opname.index(name).

Patch written by Demur Rumed.
2016-04-12 18:17:06 +02:00
Victor Stinner 7b228231c7 Issue #26647: Cleanup opcode
Simplify code to build opcode.opname. Patch written by Demur Rumed.
2016-04-12 18:15:26 +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 47c5474aa0 Issue #26623: TypeError message for JSON unserializible object now contains
object's type name, not object's representation.
Based on patch by Mahmoud Lababidi.
2016-04-10 15:46:30 +03:00
Serhiy Storchaka 96cdbe7bc8 Issue #26719: More efficient formatting of ints and floats in json. 2016-04-10 14:43:04 +03:00
Serhiy Storchaka e0805cf10e Issue #26719: More efficient formatting of ints and floats in json. 2016-04-10 14:41:19 +03: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
Berker Peksag 734423b87b Issue #16329: Add .webm to mimetypes.types_map
Patch by Giampaolo Rodola'.
2016-04-09 08:00:53 +03:00
Berker Peksag d7fdc86153 Issue #16329: Add .webm to mimetypes.types_map
Patch by Giampaolo Rodola'.
2016-04-09 08:00:20 +03:00
Martin Panter fc475a9fa6 Issue #26609: Fix HTTP server tests to request an absolute URL path 2016-04-09 04:56:10 +00:00
Berker Peksag ba22cf8bdc Issue #13952: Add .csv to mimetypes.types_map
Patch by Geoff Wilson.
2016-04-09 07:53:00 +03:00
Berker Peksag a2d7cf087f Issue #13952: Add .csv to mimetypes.types_map
Patch by Geoff Wilson.
2016-04-09 07:52:05 +03:00
Brett Cannon f3ad042bfb Issue #25609: Backport typing.ContextManager.
This has no semantic impact as the class is guarded with a hasattr()
check; this is being done to keep typing.py in sync between Python 3.5
and 3.6 as requested by Guido.
2016-04-15 10:51:30 -07: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 8bd092b501 Normalize whitespace 2016-04-08 12:16:16 -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 7278305698 Merge typing.py 3.5->3.6 (Text, ItemsView). 2016-04-05 14:57:03 -07:00
Guido van Rossum 0e0563ca2c Add Text=str. Make ItemsView derive from AbstractSet, not Set (which is the concrete set). 2016-04-05 14:54:25 -07: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 00f4648a39 Merge 3.5 (asyncio) 2016-04-01 21:43:54 +02:00
Victor Stinner c94a93aecb asyncio: Don't log ConnectionAbortedError
Issue #26509: In fatal error handlers, don't log ConnectionAbortedError which
occur on Windows.
2016-04-01 21:43:39 +02: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
Ned Deily 0a85c69f1d Revert back to 3.6.0, buildbots do not want chocolate for 04-01 2016-03-31 19:20:03 -04:00
Victor Stinner 49f324f1d4 Python 8: no pep8, no chocolate! 2016-03-31 23:30:53 +02: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 b1511f789e doctest now supports packages
Issue #26641: doctest.DocFileTest and doctest.testfile() now support packages
(module splitted into multiple directories) for the package parameter.
2016-03-30 01:29:05 +02:00
Victor Stinner 6e722bc13f Merge 3.5 (test_unittest) 2016-03-30 01:15:48 +02:00
Victor Stinner 9db2ae7263 Fix ResourceWarning in test_unittest when interrupted 2016-03-30 01:15:28 +02:00
Victor Stinner 06ddd35f5f Issue #25911: Backport os._DummyDirEntry fixes
* Fix test_os.BytesWalkTests on Windows
* Mimick better the reference os.DirEntry on Windows
* _DummyDirEntry now caches os.stat() result
* _DummyDirEntry constructor now tries to get os.stat()
* Fix os._DummyDirEntry.is_symlink(), don't follow symbolic links:
  use os.stat(path, follow_symlinks=False).
2016-03-29 13:38:22 +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 73030df77f Fix os._DummyDirEntry.is_symlink()
Issue #25911: Fix os._DummyDirEntry.is_symlink(), don't follow symbolic links:
use os.stat(path, follow_symlinks=False).
2016-03-29 11:25:00 +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
Berker Peksag 5a6c018b57 Issue #25195: Fix a regression in mock.MagicMock
_Call is a subclass of tuple (changeset 3603bae63c13 only works
for classes) so we need to implement __ne__ ourselves.

Patch by Andrew Plummer.
2016-03-28 00:30:40 +03:00
Berker Peksag ce913877e4 Issue #25195: Fix a regression in mock.MagicMock
_Call is a subclass of tuple (changeset 3603bae63c13 only works
for classes) so we need to implement __ne__ ourselves.

Patch by Andrew Plummer.
2016-03-28 00:30:02 +03:00
Berker Peksag f841909f09 Issue #23758: Improve num_params docs of create_{function,aggregate} functions
If you pass -1, the callable can take any number of arguments.

Added tests to verify the behavior.

Initial patch by Cédric Krier.
2016-03-27 22:39:41 +03:00
Berker Peksag fa0f62d6ab Issue #23758: Improve num_params docs of create_{function,aggregate} functions
If you pass -1, the callable can take any number of arguments.

Added tests to verify the behavior.

Initial patch by Cédric Krier.
2016-03-27 22:39:14 +03: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 6384c66d1f Merge 3.5 2016-03-25 12:50:54 +01:00
Victor Stinner 84ca9fe145 doctest: fix _module_relative_path() error message
Write the module name rather than <module> in the error message, if module has
no __file__ attribute (ex: package).
2016-03-25 12:50:36 +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 4f17426437 Fix bug in __import__ during Python shutdown
Issue #26637: The importlib module now emits an ImportError rather than a
TypeError if __import__() is tried during the Python shutdown process but
sys.path is already cleared (set to None).
2016-03-25 00:40:59 +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 ba8b0a7db4 Enhance os._DummyDirEntry
Issue #25911:

* Try to fix test_os.BytesWalkTests on Windows
* Try to mimick better the reference os.DirEntry on Windows
* _DummyDirEntry now caches os.stat() result
* _DummyDirEntry constructor now tries to get os.stat()
2016-03-24 12:23:18 +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 e19558af1b Add a source parameter to warnings.warn()
Issue #26604:

* Add a new optional source parameter to _warnings.warn() and warnings.warn()
* Modify asyncore, asyncio and _pyio modules to set the source parameter when
  logging a ResourceWarning warning
2016-03-23 00:28:08 +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 d02eb8a713 Issue #19164: Improve exception message of uuid.UUID()
Patch by jgauthier.
2016-03-20 16:49:10 +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 c0e7a9c72b Issue #19164: Improve exception message of uuid.UUID()
Patch by jgauthier.
2016-03-20 16:49:29 +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 eedf13fe23 Fix test_logging
Issue #26568: Fix implementation of showwarning() and formatwarning() for
test_logging.
2016-03-19 02:11:56 +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
Steve Dower 3ca3342307 Issue #26313: ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch by Baji. 2016-03-17 15:02:53 -07:00
Steve Dower 8dd7aebc23 Issue #26313: ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch by Baji. 2016-03-17 15:02:39 -07: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
Donald Stufft a209981f5f Merge 3.5 into default 2016-03-17 11:01:35 -04:00
Donald Stufft c488bc6a76 Merge 3.4 into 3.5 2016-03-17 11:01:04 -04:00
Donald Stufft 2bc69c49e1 Upgrade ensurepip._bundled pip to 8.1.1 and setuptools to 20.3 2016-03-17 11:00:08 -04:00
Victor Stinner ec748c47ac Merge 3.5 2016-03-17 09:11:54 +01:00
Victor Stinner 5c13aa1562 Fix pyclbr to support importing packages
Issue #26569: Fix pyclbr.readmodule() and pyclbr.readmodule_ex() to support
importing packages.
2016-03-17 09:06:41 +01: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 32f2eb4941 Issue #21042: Revert Linux find_library() to return just filename
This reverts most of revision 3092cf163eb4. The change worked on x86
architectures, but did not work on ARM, probably due to extra ABI flags in
the ldconfig output.
2016-03-17 07:50:22 +00: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
Robert Collins bfef0be420 #25320: Handle sockets in directories unittest discovery is scanning.
Patch from Victor van den Elzen.
2016-03-15 13:33:28 +13:00
Robert Collins ecd5383891 #25320: Handle sockets in directories unittest discovery is scanning.
Patch from Victor van den Elzen.
2016-03-15 13:29:17 +13: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
Steve Dower 11b3918164 Issue #26513: Fixes platform module detection of Windows Server 2016-03-12 08:07:34 -08:00
Steve Dower 126c9c17ef Issue #26513: Fixes platform module detection of Windows Server 2016-03-12 08:06:23 -08: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
Victor Stinner 2c2a4e63d7 Add Mock.assert_called()
Issue #26323: Add assert_called() and assert_called_once() methods to
unittest.mock.Mock.
2016-03-11 22:17:48 +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
Terry Jan Reedy a55553d7e3 Merge with 3.5 2016-03-11 15:31:02 -05:00
Terry Jan Reedy ca0250a878 Issue 25959: Explain in docstring that PhotoImage.zoom arguments are
multipliers, not final sizes.  Explain y default for .zoom and .subsample.
Initial patch by Serhiy Storchaka.
2016-03-11 15:30:35 -05:00
Serhiy Storchaka 2d68f18656 Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. 2016-03-09 10:52:08 +02:00
Martin Panter b9f3114d42 Issue #21042: Return full path in ctypes.util.find_library() on Linux
Patch by Tamás Bence Gedai.
2016-03-10 01:06:23 +00:00
Serhiy Storchaka 42a4366ad5 Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets.
Added few missed tests for configure options.
2016-03-09 10:33:51 +02:00
Serhiy Storchaka aadaa3614e Issue #15068: Avoid creating a reference loop in fileinput. 2016-03-08 23:36:25 +02:00
Serhiy Storchaka 0554d83f0f Issue #15068: Avoid creating a reference loop in fileinput. 2016-03-08 23:35:35 +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 b6bfce6c0b Issue #26475: Fixed debugging output for regular expressions with the (?x) flag. 2016-03-06 09:17:39 +02:00
Serhiy Storchaka a01a144aab Issue #26475: Fixed debugging output for regular expressions with the (?x) flag. 2016-03-06 09:15:47 +02:00
Serhiy Storchaka a0d416f0d1 Issue #26482: Allowed pickling recursive dequeues. 2016-03-06 08:55:21 +02:00
Berker Peksag 841b930a41 Issue #17940: Remove redundant code from _Section.format_help()
Output of func(*args) stored in the next line:

    item_help = join([func(*args) for func, args in self.items])

_Section.items only used by HelpFormatter._add_item() and it looks
like it doesn't have any side effects.

Patch by Yogesh Chaudhari.
2016-03-05 14:05:45 +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 3ebaea005d Sync selectors.py with upstream asyncio 2016-03-02 10:43:45 -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
Terry Jan Reedy 8131f14de9 Merge with 3.5 2016-03-01 01:19:02 -05:00
Terry Jan Reedy 5f582bdec8 Whitespace 2016-03-01 01:18:47 -05:00
Terry Jan Reedy 54f99500dd Merge with 3.5 2016-03-01 01:13:21 -05:00
Terry Jan Reedy 7811a9cf3e Document maintenance of idlelib/help.html in idlelib. 2016-03-01 01:13:07 -05:00
Terry Jan Reedy 13d09afff1 Merge with 3.5 2016-03-01 00:30:20 -05:00
Terry Jan Reedy f8cd02dcda Rebase the 3.x version of idlelib/help.html on the 3.5 version of
Doc/build/html/library/idle.html, which is built from Doc/library/idle.rst.
Help.html is an rstrip()ed copy of idle.html that can be pushed.

The displayed content is unchanged because a) the version number is not
displayed, being inherent in the version displaying the file and b) the tt
tag was ignored by the custom parser in idlelib/help.py.  The wrapped
<span class="pre"> tags remain as they were.

This will be merged in 3.6 (without conflict) because the 3.6 help.html is
a copy of the 3.5 file (which was a copy of the 3.4 file).  The two files will
remain the same until either a) there is a content change that only applies
to one of them or b) 3.5 maintenance ends and the 3.6 file is itself rebased.
2016-03-01 00:29:57 -05: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
Georg Brandl 6d6dd73aec merge with 3.5 2016-02-25 20:18:00 +01:00
Georg Brandl 8c16cb9f65 Closes #26435: fix syntax in directives. Thanks to Jakub Stasiak. 2016-02-25 20:17:45 +01: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
Raymond Hettinger 62bc321819 Fix out-of-date comment 2016-02-25 00:25:45 -08:00
Ned Deily b8da1a4fee Issue #25136: merge from 3.5 2016-02-25 00:59:16 +11:00
Ned Deily 020250f91f Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries.
As of Xcode 7, SDKs for Apple platforms now include textual-format stub
libraries whose file names have a .tbd extension rather than the
standard OS X .dylib extension.  The Apple compiler tool chain handles
these stub libraries transparently and the installed system shared libraries
are still .dylibs.  However, the new stub libraries cause problems for
third-party programs that support building with Apple SDKs and make
build-time decisions based on the presence or paths of system-supplied
shared libraries in the SDK.  In particular, building Python itself with
an SDK fails to find system-supplied libraries during setup.py's build of
standard library extension modules.  The solution is to have
find_library_file() in Distutils search for .tbd files, along with
the existing types (.a, .so, and .dylib).  Patch by Tim Smith.
2016-02-25 00:56:38 +11: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 fe93283fe1 Issue #26261: Merge NamedTemporaryFile docs from 3.5 2016-02-22 10:10:55 +00:00
Martin Panter 1f0e1f3cbb Issue #26261: Clarify NamedTemporaryFile name attribute vs file.name 2016-02-22 10:10:00 +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 2d2d08d2cc Issue #22468: Merge gettarinfo() doc from 3.5 2016-02-19 23:46:59 +00:00
Martin Panter f817a48d17 Issues #22468, #21996, #22208: Clarify gettarinfo() and TarInfo usage
* The Windows-specific binary notice was probably a Python 2 thing
* Make it more obvious gettarinfo() is based on stat(), and that non-ordinary
  files may need special care
* The file name must be text; suggest dummy arcname as a workaround
* Indicate TarInfo may be used directly, not just via gettarinfo()
2016-02-19 23:34:56 +00: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
Vinay Sajip 6f79c2c826 Fixes #26348: Merged fix from 3.5. 2016-02-13 16:27:25 +00:00
Vinay Sajip b2a2aa7664 Fixes #26348: Corrected typos in activate.fish script. 2016-02-13 16:26:35 +00: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 7c90a82a01 Issue #25995: os.walk() no longer uses FDs proportional to the tree depth.
Different solution from 3.5.
2016-02-11 13:31:00 +02:00
Serhiy Storchaka 06c45e6e9c Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. 2016-02-11 13:29:28 +02: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
Martin Panter 96a4f07107 Issues #26310, #26311: Fix typos in the documentation and code comments 2016-02-10 01:17:51 +00:00
Martin Panter 263c448a2e Issues #26310, 26311: Merge typo fixes from 3.5 2016-02-10 01:18: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