summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* Give proper credit for figuring out and writing PEP-3118 tests. (GH-18644) ↵Miss Islington (bot)2020-02-241-0/+2
| | | | | | | (#18646) (cherry picked from commit b942ba03b8530f26240d4e36567d2ff42d701420) Authored-by: Stefan Krah <skrah@bytereef.org>
* bpo-39681: Fix C pickle regression with minimal file-like objects (GH-18592) ↵Miss Islington (bot)2020-02-231-4/+21
| | | | | | | | | | | | (#18630) Fix a regression where the C pickle module wouldn't allow unpickling from a file-like object that doesn't expose a readinto() method. (cherry picked from commit 9f37872e307734666a7169f7be6e3370d3068282) Co-authored-by: Antoine Pitrou <antoine@python.org> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* bpo-39382: Avoid dangling object use in abstract_issubclass() (GH-18530)Miss Islington (bot)2020-02-221-0/+21
| | | | | | | Hold reference of __bases__ tuple until tuple item is done with, because by dropping the reference the item may be destroyed. (cherry picked from commit 1c56f8ffad44478b4214a2bf8eb7cf51c28a347a) Co-authored-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
* bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581) ↵Miss Islington (bot)2020-02-211-0/+35
| | | | | | | (#18584) (cherry picked from commit 90930e65455f60216f09d175586139242dbba260) Authored-by: Stefan Krah <skrah@bytereef.org>
* [3.8] bpo-39546: argparse: Honor allow_abbrev=False for specified ↵Miss Islington (bot)2020-02-181-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | prefix_chars (GH-18337) (GH-18543) When `allow_abbrev` was first added, disabling the abbreviation of long options broke the grouping of short flags ([bpo-26967](https://bugs.python.org/issue26967)). As a fix, b1e4d1b603 (contained in v3.8) ignores `allow_abbrev=False` for a given argument string if the string does _not_ start with "--" (i.e. it doesn't look like a long option). This fix, however, doesn't take into account that long options can start with alternative characters specified via `prefix_chars`, introducing a regression: `allow_abbrev=False` has no effect on long options that start with an alternative prefix character. The most minimal fix would be to replace the "starts with --" check with a "starts with two prefix_chars characters". But `_get_option_tuples` already distinguishes between long and short options, so let's instead piggyback off of that check by moving the `allow_abbrev` condition into `_get_option_tuples`. https://bugs.python.org/issue39546 (cherry picked from commit 8edfc47baec7ff4cb1b9db83dd35c8ffc1d498a4) Co-authored-by: Kyle Meyer <kyle@kyleam.com> https://bugs.python.org/issue39546 Automerge-Triggered-By: @encukou
* [3.8] bpo-39453: Fix contains method of list to hold strong references ↵Dong-hee Na2020-02-171-0/+7
| | | | (GH-18204)
* Revert "[3.8] bpo-27657: Fix urlparse() with numeric paths (GH-16839)" ↵Senthil Kumaran2020-02-161-6/+4
| | | | | | | | | | | | | | | | | | | | | | | (GH-18525) This reverts commit 0f3187c1ce3b3ace60f6c1691dfa3d4e744f0384. The change broke the backwards compatibility of parsing behavior in a patch release of Python (3.8.1). A decision was taken to revert this patch in 3.8.2. In https://bugs.python.org/issue27657 it was decided that the previous behavior like >>> urlparse('localhost:8080') ParseResult(scheme='', netloc='', path='localhost:8080', params='', query='', fragment='') >>> urlparse('undefined:8080') ParseResult(scheme='', netloc='', path='undefined:8080', params='', query='', fragment='') needs to be preserved in patch releases as number of users rely upon it. Explicitly mention the releases involved with the revert in NEWS. Adopt the wording suggested by @ned-deily.
* [3.8] bpo-39606: allow closing async generators that are already closed ↵Miss Islington (bot)2020-02-131-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-18475) (GH-18501) The fix for [bpo-39386](https://bugs.python.org/issue39386) attempted to make it so you couldn't reuse a agen.aclose() coroutine object. It accidentally also prevented you from calling aclose() at all on an async generator that was already closed or exhausted. This commit fixes it so we're only blocking the actually illegal cases, while allowing the legal cases. The new tests failed before this patch. Also confirmed that this fixes the test failures we were seeing in Trio with Python dev builds: https://github.com/python-trio/trio/pull/1396 https://bugs.python.org/issue39606 (cherry picked from commit 925dc7fb1d0db85dc137afa4cd14211bf0d67414) Co-authored-by: Nathaniel J. Smith <njs@pobox.com> https://bugs.python.org/issue39606 Automerge-Triggered-By: @njsmith
* bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)Miss Islington (bot)2020-02-121-0/+27
| | | | | (cherry picked from commit 6e619c48b8e804ece9521453fc8da0640a04d5b1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-39219: Fix SyntaxError attributes in the tokenizer. (GH-17828)Miss Islington (bot)2020-02-121-1/+13
| | | | | | | * Always set the text attribute. * Correct the offset attribute for non-ascii sources. (cherry picked from commit 0cc6b5e559b8303b18fdd56c2befd900fe7b5e35) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-39595: Improve zipfile.Path performance (GH-18406) (GH-18472)Miss Islington (bot)2020-02-124-41/+166
| | | | | | | | | | | | | | | | | | | | | | | * Improve zipfile.Path performance on zipfiles with a large number of entries. * 📜🤖 Added by blurb_it. * Add bpo to blurb * Sync with importlib_metadata 1.5 (6fe70ca) * Update blurb. * Remove compatibility code * Add stubs module, omitted from earlier commit Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit e5bd73632e77dc5ab0cab77e48e94ca5e354be8a) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-39299: Add more tests for mimetypes and its cli. (GH-17949)Miss Islington (bot)2020-02-111-4/+80
| | | | | | | | | | * Add tests for case insensitive check of types and extensions as fallback. * Add tests for data url with no comma. * Add tests for read_mime_types. * Add tests for the mimetypes cli and refactor __main__ code to private function. * Restore mimetypes.knownfiles value at the end of the test. (cherry picked from commit d8efc1495194228c3a4cd472200275d6491d8e2d) Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
* bpo-39590: make deque.__contains__ and deque.count hold strong references ↵Miss Islington (bot)2020-02-091-0/+12
| | | | | | | | | | (GH-18421) (GH-18423) (cherry picked from commit c6dedde160a9fce5d049e860f586ad8f93aec822) Co-authored-by: sweeneyde <36520290+sweeneyde@users.noreply.github.com> Co-authored-by: sweeneyde <36520290+sweeneyde@users.noreply.github.com>
* [3.8] bpo-39579: Fix Attribute end_col_offset to point at the current node ↵Lysandros Nikolaou2020-02-081-0/+8
| | | | | | | | | | | | | | | (GH-18405) (GH-18408) (cherry picked from commit d2e1098641f98594702ef29049c3c4a3f394786f) https://bugs.python.org/issue39579 Automerge-Triggered-By: @gvanrossum
* bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017)Miss Islington (bot)2020-02-061-0/+37
| | | | | | | | Some numerator types used (specifically NumPy) decides to not return a Python boolean for the "a != b" operation. Using the equivalent call to bool() guarantees a bool return also for such types. (cherry picked from commit 427c84f13f7719e6014a21bd1b81efdc02a046fb) Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)Miss Islington (bot)2020-02-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | When called on a closed object, readinto() segfaults on account of a write to a freed buffer: ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==220553== Access not within mapped region at address 0x2A ==220553== at 0x48408A0: memmove (vg_replace_strmem.c:1272) ==220553== by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972) ==220553== by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053) ==220553== by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253) Reproducer: reader = open ("/dev/zero", "rb") _void = reader.read (42) reader.close () reader.readinto (bytearray (42)) GH-GH-GH- BANG! The problem exists since 2012 when commit dc469454ec added code to free the read buffer on close(). Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> (cherry picked from commit cb1c0746f277052e45a60d6c436a765e34722821) Co-authored-by: Philipp Gesang <phg@phi-gamma.net>
* bpo-37224: Improve test__xxsubinterpreters.DestroyTests (GH-18058)Miss Islington (bot)2020-02-041-1/+5
| | | | | | | | Adds an additional assertion check based on a race condition for `test__xxsubinterpreters.DestroyTests.test_still_running` discovered in the bpo issue. https://bugs.python.org/issue37224 (cherry picked from commit f03a8f8d5001963ad5b5b28dbd95497e9cc15596) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* Fixes in sorting descriptions (GH-18317)Miss Islington (bot)2020-02-041-1/+1
| | | | | | | | Improvements in listsort.txt and a comment in sortperf.py. Automerge-Triggered-By: @csabella (cherry picked from commit 24e5ad4689de9adc8e4a7d8c08fe400dcea668e6) Co-authored-by: Stefan Pochmann <stefan.pochmann@gmail.com>
* [3.8] bpo-39492: Fix a reference cycle between reducer_override and a ↵Antoine Pitrou2020-02-021-0/+24
| | | | | | | | | | | Pickler instance (GH-18266) (#18316) https://bugs.python.org/issue39492 Automerge-Triggered-By: @pitrou (cherry picked from commit 0f2f35e) Co-authored-by: Pierre Glaser <pierreglaser@msn.com>
* bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)Miss Islington (bot)2020-01-301-1/+6
| | | | | | | Skip test_zipfile.test_add_file_after_2107() if time.localtime() fails with OverflowError. It is the case on AIX 6.1 for example. (cherry picked from commit c232c9110cfefa0935cbf158e35e91746a8a9361) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)Miss Islington (bot)2020-01-291-0/+12
| | | | | | | | | | | XFS filesystem is limited to 32-bit timestamp, but the utimensat() syscall doesn't fail. Moreover, there is a VFS bug which returns a cached timestamp which is different than the value on disk. https://bugzilla.redhat.com/show_bug.cgi?id=1795576 https://bugs.python.org/issue39460GH-msg360952 (cherry picked from commit 3cb49b62e61208efcefbc04414e769fc173f205d) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on ↵Miss Islington (bot)2020-01-281-8/+14
| | | | | | | | | | | | Windows (GH-17961) In bpo-36264 os.path.expanduser was changed to ignore HOME on Windows. Path.expanduser/home still honored HOME despite being documented as behaving the same as os.path.expanduser. This makes them also ignore HOME so that both implementations behave the same way again. (cherry picked from commit c45a2aa9e255b5c7c211faa79f6b23895b64ab27) Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
* [3.8] bpo-39390 shutil: fix argument types for ignore callback (GH-18122)mbarkhau2020-01-271-0/+42
|
* [3.8] bpo-35182: fix communicate() crash after child closes its pipes ↵Alex Rebert2020-01-231-0/+11
| | | | | | | | | | | | | | | | | (GH-18117) (GH-18148) When communicate() is called in a loop, it crashes when the child process has already closed any piped standard stream, but still continues to be running Co-authored-by: Andriy Maletsky <andriy.maletsky@gmail.com>. (cherry picked from commit d3ae95e1e945ed20297e1c38ba43a18b7a868ab6) Co-authored-by: Alex Rebert <alex@forallsecure.com> https://bugs.python.org/issue35182
* bpo-39421: Fix posible crash in heapq with custom comparison operators ↵Miss Islington (bot)2020-01-231-0/+31
| | | | | | | | | | | | (GH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators (cherry picked from commit 79f89e6e5a659846d1068e8b1bd8e491ccdef861) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Move test_math tests (GH-18098) (GH-18102)Victor Stinner2020-01-211-129/+129
| | | | | testPerm() and testComb() belong to MathTests, not to IsCloseTests(). (cherry picked from commit 59e2d26b258c12f18d8d2e789ef741703d6c52d5)
* bpo-39389: gzip: fix compression level metadata (GH-18077)Miss Islington (bot)2020-01-211-0/+20
| | | | | | | | | As described in RFC 1952, section 2.3.1, the XFL (eXtra FLags) byte of a gzip member header should indicate whether the DEFLATE algorithm was tuned for speed or compression ratio. Prior to this patch, archives emitted by the `gzip` module always indicated maximum compression. (cherry picked from commit eab3b3f1c60afecfb4db3c3619109684cb04bd60) Co-authored-by: William Chargin <wchargin@gmail.com>
* bpo-39386: Prevent double awaiting of async iterator (GH-18081)Miss Islington (bot)2020-01-201-0/+36
| | | | | (cherry picked from commit a96e06db77dcbd3433d39761ddb4615d7d96284a) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.8] bpo-39033: Fix NameError in zipimport during hash validation ↵Karthikeyan Singaravelan2020-01-141-0/+16
| | | | | | | | | | | (GH-17588) (GH-17642) Fix `NameError` in `zipimport` during hash validation and add a regression test. (cherry picked from commit 79f02fee1a542c440fd906fd54154c73fc0f8235) https://bugs.python.org/issue39033
* bpo-38293: Allow shallow and deep copying of property objects (GH-16438)Miss Islington (bot)2020-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | Copying property objects results in a TypeError. Steps to reproduce: ``` >>> import copy >>> obj = property() >>> copy.copy(obj) ```` This affects both shallow and deep copying. My idea for a fix is to add property objects to the list of "atomic" objects in the copy module. These already include types like functions and type objects. I also added property objects to the unit tests test_copy_atomic and test_deepcopy_atomic. This is my first PR, and it's highly likely I've made some mistake, so please be kind :) https://bugs.python.org/issue38293 (cherry picked from commit 9f3fc6c5b4993f2b362263b494f84793a21aa073) Co-authored-by: Guðni Natan Gunnarsson <1493259+GudniNatan@users.noreply.github.com>
* [3.8] Add test cases for dataclasses. (GH-17909) (GH-17919)Miss Islington (bot)2020-01-101-0/+19
| | | | | | | | | | | | * Add test cases for dataclasses. * Add test for repr output of field. * Add test for ValueError to be raised when both default and default_factory are passed. (cherry picked from commit eef1b027ab70704bcaa60a089e4ae1592c504b86) Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Automerge-Triggered-By: @ericvsmith
* Fix typo in test's docstring (GH-17856) (GH-17923)Miss Islington (bot)2020-01-091-1/+1
| | | | | | | | | * Fix typo in test's docstring. contination -> continuation. (cherry picked from commit 2f65aa465865930f8364645b1466d2751c4086d3) Co-authored-by: Daniel Hahler <git@thequod.de> Co-authored-by: Daniel Hahler <github@thequod.de>
* bpo-25172: Reduce scope of crypt import tests (GH-17881)Miss Islington (bot)2020-01-091-4/+5
| | | | | (cherry picked from commit ed367815eeb9329c48a86a8a7fa3186e27a10f2c) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-39242: Updated the Gmane domain into news.gmane.io (GH-17903)Miss Islington (bot)2020-01-081-2/+2
| | | | | (cherry picked from commit 2e6a8efa837410327b593dc83c57492253b1201e) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* [3.8] bpo-39191: Fix RuntimeWarning in asyncio test (GH-17863) (#17894)Andrew Svetlov2020-01-071-2/+6
| | | | | | https://bugs.python.org/issue39191. (cherry picked from commit 10ac0cded26d91c3468e5e5a87cecad7fc0bcebd) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-39209: Manage correctly multi-line tokens in interactive mode (GH-17860)Miss Islington (bot)2020-01-061-0/+36
| | | | | (cherry picked from commit 5ec91f78d59d9c39b984f284e00cd04b96ddb5db) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Fix constant folding optimization for positional only arguments (GH-17837)Miss Islington (bot)2020-01-051-0/+12
| | | | | (cherry picked from commit b121a4a45ff4bab8812a9b26ceffe5ad642f5d5a) Co-authored-by: Anthony Sottile <asottile@umich.edu>
* bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. ↵Miss Islington (bot)2020-01-051-0/+1
| | | | | | | (GH-17616) (cherry picked from commit b19c0d77e6f25ea831ab608c71f15d0d9266c8c4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)Miss Islington (bot)2020-01-051-0/+23
| | | | | | No longer import the re module if it is not needed. (cherry picked from commit 41ec17e45d54473d32f543396293256f1581e44d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)Miss Islington (bot)2020-01-051-0/+22
| | | | | | Ignore leading dots and no longer ignore a trailing newline. (cherry picked from commit 6a265f0d0c0a4b3b8fecf4275d49187a384167f4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix SystemError when nested function has annotation on positional-only ↵Miss Islington (bot)2020-01-051-0/+7
| | | | | | | argument (GH-17826) (cherry picked from commit ec007cb43faf5f33d06efbc28152c7fdcb2edb9c) Co-authored-by: Anthony Sottile <asottile@umich.edu>
* bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. ↵Miss Islington (bot)2020-01-011-0/+31
| | | | | | (GH-17773) (GH-17785) (cherry picked from commit 46abfc1416ff8e450999611ef8f231ff871ab133)
* bpo-39176: Improve error message for 'named assignment' (GH-17777) (GH-17778)Miss Islington (bot)2020-01-012-3/+3
| | | | | | | | (cherry picked from commit 37143a8e3b2e9245d52f4ddebbdd1c6121c96884) Co-authored-by: Ned Batchelder <ned@nedbatchelder.com> Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* [3.8] bpo-38588: Fix possible crashes in dict and list when calling P… ↵Dong-hee Na2019-12-312-1/+36
| | | | | | | | | | | | | | | | | | | | (GH-17764) * [3.8] bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734) Take strong references before calling PyObject_RichCompareBool to protect against the case where the object dies during the call. (cherry picked from commit 2d5bf568eaa5059402ccce9ba5a366986ba27c8a) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com> * Update Objects/listobject.c @methane's suggestion Co-Authored-By: Inada Naoki <songofacandy@gmail.com> Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-38610: Fix possible crashes in several list methods (GH-17022)Miss Islington (bot)2019-12-301-0/+26
| | | | | | Hold strong references to list elements while calling PyObject_RichCompareBool(). (cherry picked from commit d9e561d23d994e3ed15f4fcbd7ee5c8fe50f190b) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* [3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684)Bar Harel2019-12-231-0/+8
| | | | https://bugs.python.org/issue38878
* bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() ↵Victor Stinner2019-12-181-3/+11
| | | | | | | | | (GH-17652) (GH-17655) Fix test_ressources_gced_in_workers() of test_concurrent_futures: explicitly stop the manager to prevent leaking a child process running in the background after the test completes. (cherry picked from commit 673c39331f844a80c465efd7cff88ac55c432bfb)
* bpo-38546: multiprocessing tests stop the resource tracker (GH-17641) (GH-17647)Victor Stinner2019-12-182-21/+2
| | | | | | | | | | | | Multiprocessing and concurrent.futures tests now stop the resource tracker process when tests complete. Add ResourceTracker._stop() method to multiprocessing.resource_tracker. Add _cleanup_tests() helper function to multiprocessing.util: share code between multiprocessing and concurrent.futures tests. (cherry picked from commit 9707e8e22d80ca97bf7a9812816701cecde6d226)
* [3.8] bpo-39080: Starred Expression's column offset fix when inside a CALL ↵Pablo Galindo2019-12-181-0/+9
| | | | | | | | | | | | | | | (GH-17645) (GH-17649) … Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 50d4f12958bf806a4e1a1021d70cfd5d448c5cba) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> https://bugs.python.org/issue39080
* bpo-38295: prevent test_relative_path of test_py_compile failure on macOS ↵Ned Deily2019-12-171-1/+1
| | | | Catalina (GH-17636)