summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41100: in test_platform, ignore 10.16 (GH-23485) (GH-23486)Miss Islington (bot)2020-11-241-1/+4
| | | | | | (cherry picked from commit c0c23ea72b76b06b7db0d09415fa90bab8ded63a) Co-authored-by: Ned Deily <nad@python.org>
* [3.9] bpo-41100: Support macOS 11 and Apple Silicon (GH-22855) (GH-23295)Ronald Oussoren2020-11-225-1/+262
| | | | | | | | | | | | | | | | | | | | * [3.9] bpo-41100: Support macOS 11 and Apple Silicon (GH-22855) Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.. (cherry picked from commit 41761933c1c30bb6003b65eef1ba23a83db4eae4) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> * Back port of changes to _decimal to support arm64 * temp_dir is in test.support in 3.9
* Clarify that Set._from_iterable is not required to be a classmethod. ↵Miss Islington (bot)2020-11-211-0/+56
| | | | (GH-23272) (GH-23450)
* bpo-40550: Fix time-of-check/time-of-action issue in ↵Miss Islington (bot)2020-11-211-0/+13
| | | | | | | | | | subprocess.Popen.send_signal. (GH-20010) send_signal() now swallows the exception if the process it thought was still alive winds up not to exist anymore (always a plausible race condition despite the checks). Co-authored-by: Gregory P. Smith <greg@krypto.org> (cherry picked from commit 01a202ab6b0ded546e47073db6498262086c52e9) Co-authored-by: Filipe Laíns <lains@archlinux.org>
* bpo-28002: Roundtrip f-strings with ast.unparse better (GH-19612) (GH-23430)Miss Islington (bot)2020-11-201-13/+29
| | | | | | | | | | | | | | By attempting to avoid backslashes in f-string expressions. We also now proactively raise errors for some backslashes we can't avoid while unparsing FormattedValues Co-authored-by: hauntsaninja <> Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com> Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> (cherry picked from commit a993e901ebe60c38d46ecb31f771d0b4a206828c) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* bpo-42345: Fix hash implementation of typing.Literal (GH-23383)Miss Islington (bot)2020-11-191-0/+5
| | | | | | | | | | Fix hash implementation of `typing.Literal`. Update docs regarding `typing.Litaral` caching. Base implementation was done in PR GH-23294. (cherry picked from commit 1b54077ff6f5c1379e097e9f8e8648da9826d6ec) Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
* [3.9] bpo-42381: Allow walrus in set literals and set comprehensions ↵Pablo Galindo2020-11-181-3/+57
| | | | | | | | | | | | | | | | (GH-23332) (GH-23333) Currently walruses are not allowerd in set literals and set comprehensions: >>> {y := 4, 4**2, 3**3} File "<stdin>", line 1 {y := 4, 4**2, 3**3} ^ SyntaxError: invalid syntax but they should be allowed as well per PEP 572. (cherry picked from commit b0aba1fcdc3da952698d99aec2334faa79a8b68c) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-42398: Fix "make regen-all" race condition (GH-23362) (GH-23367)Victor Stinner2020-11-181-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a race condition in "make regen-all" when make -jN option is used to run jobs in parallel. The clinic.py script now only use atomic write to write files. Moveover, generated files are now left unchanged if the content does not change, to not change the file modification time. The "make regen-all" command runs "make clinic" and "make regen-importlib" targets: * "make regen-importlib" builds object files (ex: Modules/_weakref.o) from source files (ex: Modules/_weakref.c) and clinic files (ex: Modules/clinic/_weakref.c.h) * "make clinic" always rewrites all clinic files (ex: Modules/clinic/_weakref.c.h) Since there is no dependency between "clinic" and "regen-importlib" Makefile targets, these two targets can be run in parallel. Moreover, half of clinic.py file writes are not atomic and so there is a race condition when "make regen-all" runs jobs in parallel using make -jN option (which can be passed in MAKEFLAGS environment variable). Fix clinic.py to make all file writes atomic: * Add write_file() function to ensure that all file writes are atomic: write into a temporary file and then use os.replace(). * Moreover, write_file() doesn't recreate or modify the file if the content does not change to avoid modifying the file modification file. * Update test_clinic to verify these assertions with a functional test. * Remove Clinic.force attribute which was no longer used, whereas Clinic.verify remains useful. (cherry picked from commit 8fba9523cf08029dc2e280d9f48fdd57ab178c9d)
* [3.9] bpo-41561: skip test_min_max_version_mismatch (GH-22308) (GH-23363)Miss Islington (bot)2020-11-181-0/+1
| | | | | | | | | | | skip test_min_max_version_mismatch when TLS 1.0 is not available Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit ce04e7105bc396c32667a22b928a712ba0778a3f) Co-authored-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
* [3.9] bpo-42332: Add weakref slot to types.GenericAlias (GH-23250) (GH-23309)kj2020-11-171-38/+52
| | | (cherry picked from commit 384b7a4bd988986bca227c7e85c32d766da74708)
* [3.9] bpo-39934: Account for control blocks in 'except' in compiler. ↵Irit Katriel2020-11-171-0/+9
| | | | | (GH-22395) (GH-23303) * bpo-39934: backport PR 22395 to 3.9
* [3.9] bpo-42345: Fix three issues with typing.Literal parameters (GH-23294) ↵Yurii Karabas2020-11-171-0/+25
| | | | | | | | | | | | | (GH-23335) Literal equality no longer depends on the order of arguments. Fix issue related to `typing.Literal` caching by adding `typed` parameter to `typing._tp_cache` function. Add deduplication of `typing.Literal` arguments. (cherry picked from commit f03d318ca42578e45405717aedd4ac26ea52aaed) Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
* bpo-40637: Don't test builtin PBKDF2 without builtin hashes (GH-20980)Miss Islington (bot)2020-11-171-9/+18
| | | | | | | | | | Skip testing of pure Python PBKDF2 when one or more builtin hash module is not available. Otherwise the import of hashlib prints noise on stderr. Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 975022b77b0024ea1548f19d5f91aba5ba1eed59) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-42374: Allow unparenthesized walrus in genexps (GH-23319) (GH-23329)Lysandros Nikolaou2020-11-161-0/+9
| | | | | This fixes a regression that was introduced by the new parser. (cherry picked from commit cb3e5ed0716114393696ec7201e51fe0595eab4f)
* bpo-42350: Fix Thread._reset_internal_locks() (GH-23268)Miss Islington (bot)2020-11-161-0/+29
| | | | | | | | Fix the threading.Thread class at fork: do nothing if the thread is already stopped (ex: fork called at Python exit). Previously, an error was logged in the child process. (cherry picked from commit 5909a494cd3ba43143b28bd439773ed85a485dfc) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-42140: Improve asyncio.wait function (GH-22938)Miss Islington (bot)2020-11-101-0/+24
| | | | | | | | | | | | | GH- Improve asyncio.wait function The original code creates the futures set two times. We can create this set before, avoiding the second creation. This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty. Automerge-Triggered-By: GH:1st1 (cherry picked from commit 7e5ef0a5713f968f6e942566c78bf57ffbef01de) Co-authored-by: Diogo Dutra <diogodutradamata@gmail.com>
* bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() ↵Miss Islington (bot)2020-11-101-0/+18
| | | | | | | | | | | (GH-23020) The overflow occurs under some circumstances when a task or future recursively returns itself. Co-authored-by: Kyle Stanley <aeros167@gmail.com> (cherry picked from commit 42d873c63aa9d160c132be4a34599531574db12c) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-42233: Correctly repr GenericAlias when used with typing module (GH-23081)Miss Islington (bot)2020-11-071-0/+7
| | | | | | | | | | | | | | | | | | Noticed by @serhiy-storchaka in the bpo. `typing`'s types were not showing the parameterized generic. Eg. previously: ```python >>> typing.Union[dict[str, float], list[int]] 'typing.Union[dict, list]' ``` Now: ```python >>> typing.Union[dict[str, float], list[int]] 'typing.Union[dict[str, float], list[int]]' ``` Automerge-Triggered-By: GH:gvanrossum (cherry picked from commit 1f7dfb277e5b88cddc13e5024766be787a3e9127) Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
* Disable peg generator tests when building with PGO (GH-23141)Miss Islington (bot)2020-11-041-0/+6
| | | | | | | | Otherwise, when running the testsuite, test_peg_generator tries to compile C code using the optimized flags and fails because it cannot find the profile data. (cherry picked from commit 100964e0310d3a2040d0db976f7984d0507b2dbd) Co-authored-by: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
* bpo-42103: Improve validation of Plist files. (GH-22882)Miss Skeleton (bot)2020-11-021-49/+340
| | | | | | | | | | | * Prevent some possible DoS attacks via providing invalid Plist files with extremely large number of objects or collection sizes. * Raise InvalidFileException for too large bytes and string size instead of returning garbage. * Raise InvalidFileException instead of ValueError for specific invalid datetime (NaN). * Raise InvalidFileException instead of TypeError for non-hashable dict keys. * Add more tests for invalid Plist files. (cherry picked from commit 34637a0ce21e7261b952fbd9d006474cc29b681f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-42224: Fix test_format when locale does not expect number grouping ↵Lysandros Nikolaou2020-11-021-2/+5
| | | | | | (GH-23067) (cherry picked from commit 301822859b3fc34801a06f1090d62f9f2ee5b092)
* [3.9] bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings. ↵Miss Skeleton (bot)2020-11-011-0/+12
| | | | | | | | | | | (GH-23059) (GH-23071) [[bpo-29566]()]() notes that binhex.binhex uses inconsistent line endings (both Unix and MacOS9 line endings are used). This PR changes this to use the MacOS9 line endings everywhere. (cherry picked from commit 2165cea548f961b308050f30d1f042a377651d44) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Automerge-Triggered-By: GH:ronaldoussoren
* [3.9] bpo-42218: Correctly handle errors in left-recursive rules (GH-23065) ↵Lysandros Nikolaou2020-10-311-0/+8
| | | | | | | | | | | | (GH-23066) Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 02cdfc93f82fecdb7eae97a868d4ee222b9875d9) Automerge-Triggered-By: GH:lysnikolaou
* [3.9] bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the ↵Pablo Galindo2020-10-311-0/+17
| | | | | | | barry_as_flufl rule (GH-23048) (GH-23051) (cherry picked from commit 06f8c3328dcd81c84d1ee2b3a57b5381dcb38482) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-41659: Disallow curly brace directly after primary (GH-22996) (#23006)Lysandros Nikolaou2020-10-272-0/+4
| | | (cherry picked from commit 15acc4eaba8519d7d5f2acaffde65446b44dcf79)
* [3.9] bpo-42146: Fix memory leak in subprocess.Popen() in case of uid/gid ↵Miss Skeleton (bot)2020-10-261-0/+13
| | | | | | | | | | | | | | | | | overflow (GH-22966) (GH-22980) Fix memory leak in subprocess.Popen() in case of uid/gid overflow Also add a test that would catch this leak with `--huntrleaks`. Alas, the test for `extra_groups` also exposes an inconsistency in our error reporting: we use a custom ValueError for `extra_groups`, but propagate OverflowError for `user` and `group`. (cherry picked from commit c0590c0033e86f98cdf5f2ca6898656f98ab4053) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru> Automerge-Triggered-By: GH:gpshead
* [3.9] bpo-41052: Fix pickling heap types implemented in C with protocols 0 ↵Serhiy Storchaka2020-10-251-0/+18
| | | | | and 1 (GH-22870). (GH-22963) (cherry picked from commit 8cd1dbae32d9303caac3a473d3332f17bc98c921)
* [3.9] bpo-40592: shutil.which will not return None anymore if ; is the last ↵Miss Skeleton (bot)2020-10-231-0/+17
| | | | | | | | | | char in PATHEXT (GH-20088) (GH-22912) shutil.which will not return None anymore for empty str in PATHEXT Empty PATHEXT will now be defaulted to _WIN_DEFAULT_PATHEXT (cherry picked from commit da6f098188c9825f10ae60db8987056b3a54c2e8) Co-authored-by: Christopher Marchfelder <marchfelder@googlemail.com>
* bpo-42057: Add a test case (GH-22878)Inada Naoki2020-10-221-0/+7
|
* bpo-41316: Make tarfile follow specs for FNAME (GH-21511)Miss Skeleton (bot)2020-10-211-1/+13
| | | | | | | | | | | | | tarfile writes full path to FNAME field of GZIP format instead of just basename if user specified absolute path. Some archive viewers may process file incorrectly. Also it creates security issue because anyone can know structure of directories on system and know username or other personal information. RFC1952 says about FNAME: This is the original name of the file being compressed, with any directory components removed. So tarfile must remove directory names from FNAME and write only basename of file. Automerge-Triggered-By: @jaraco (cherry picked from commit 22748a83d927d3da1beaed771be30887c42b2500) Co-authored-by: Artem Bulgakov <ArtemSBulgakov@ya.ru>
* bpo-38324: Fix test__locale.py Windows failures (GH-20529)Miss Skeleton (bot)2020-10-201-0/+4
| | | | | | | Use wide-char _W_* fields of lconv structure on Windows Remove "ps_AF" from test__locale.known_numerics on Windows (cherry picked from commit f2312037e3a974d26ed3e23884f94c6af111a27a) Co-authored-by: TIGirardi <tiagoigirardi@gmail.com>
* bpo-41491: plistlib: accept hexadecimal integer values in xml plist files ↵Miss Skeleton (bot)2020-10-201-0/+13
| | | | | | | (GH-22764) (GH-22806) (cherry picked from commit 3185267400be853404f22a1e06bb9fe1210735c7) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS ↵Miss Skeleton (bot)2020-10-201-0/+12
| | | | | | | (GH-22762) (GH-22773) (cherry picked from commit 93a1ccabdede416425473329b8c718d507c55e29) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* bpo-42051: Reject XML entity declarations in plist files (GH-22760)Miss Skeleton (bot)2020-10-201-0/+18
| | | | | (cherry picked from commit 05ee790f4d1cd8725a90b54268fc1dfe5b4d1fa2) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* bpo-38912: fix close before connect callback in test_asyncio SSL tests ↵Miss Skeleton (bot)2020-10-201-0/+2
| | | | | | | | (GH-22691) Reduces the rate at which the ENV CHANGED failure occurs in test_asyncio SSL tests (due to unclosed transport), but does not 100% resolve it. (cherry picked from commit de73d432bb29f6439f2db16cb991e15e09c70c26) Co-authored-by: Justin Turner Arthur <justinarthur@gmail.com>
* bpo-27321 Fix email.generator.py to not replace a non-existent header. ↵Miss Skeleton (bot)2020-10-191-0/+35
| | | | | | | | | | | | | | (GH-18074) This PR replaces GH-1977. The reason for the replacement is two-fold. The fix itself is different is that if the CTE header doesn't exist in the original message, it is inserted. This is important because the new CTE could be quoted-printable whereas the original is implicit 8bit. Also the tests are different. The test_nonascii_as_string_without_cte test in GH-1977 doesn't actually test the issue in that it passes without the fix. The test_nonascii_as_string_without_content_type_and_cte test is improved here, and even though it doesn't fail without the fix, it is included for completeness. Automerge-Triggered-By: @warsaw (cherry picked from commit bf838227c35212709dc43b3c3c57f8e1655c1d24) Co-authored-by: Mark Sapiro <mark@msapiro.net>
* bpo-40492: Fix --outfile with relative path when the program changes it ↵Anthony Sottile2020-10-181-1/+15
| | | | | working dir (GH-19910) (cherry picked from commit 3c0ac18504cfeed822439024339d5717f42bdd66)
* bpo-41966: Fix pickling pure datetime.time subclasses (GH-22731) (GH-22747)Miss Skeleton (bot)2020-10-181-0/+3
| | | | | | (cherry picked from commit c304c9a7efa8751b5bc7526fa95cd5f30aac2b92) Co-authored-by: scaramallion <scaramallion@users.noreply.github.com>
* bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message ↵Miss Skeleton (bot)2020-10-181-0/+12
| | | | | | | (GH-19940) (cherry picked from commit 3635388f52b42e5280229104747962117104c453) Co-authored-by: Max Bernstein <tekknolagi@users.noreply.github.com>
* bpo-41984: GC track all user classes (GH-22701/GH-22702)Miss Skeleton (bot)2020-10-152-5/+24
| | | (cherry picked from commit c13b847a6f913b72eeb71651ff626390b738d973)
* bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)Miss Skeleton (bot)2020-10-141-2/+0
| | | | | (cherry picked from commit 6a48518e8dac3521ff387ee67cdf33783114a257) Co-authored-by: Ned Deily <nad@python.org>
* [3.9] bpo-39481: Fix duplicate SimpleQueue type in test_genericalias.py ↵Saiyang Gou2020-10-121-2/+2
| | | | | | | | | | (GH-22619) (#22624) There are two different `SimpleQueue` types imported (from `multiprocessing.queues` and `queue`) in `Lib/test/test_genericalias.py`, the second one shadowing the first one, making the first one not actually tested. Fix by using different names. Automerge-Triggered-By: @gvanrossum. (cherry picked from commit b2c0a43699bd9023a69e3fa554f5488a2e17e278) Co-authored-by: Saiyang Gou <gousaiyang@163.com>
* bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() ↵Victor Stinner2020-10-121-8/+13
| | | | | | | | | | (GH-22655) (GH-22656) The test now waits until all threads complete to avoid leaking running threads. Also, use regular threads rather than daemon threads. (cherry picked from commit 13ff396c019d548ba181cf22c6f39309a300723c)
* [3.9] bpo-41371: Handle lzma lib import error in test_zoneinfo.py (GH-21734) ↵Karthikeyan Singaravelan2020-10-101-1/+2
| | | | | | | (GH-22039) (cherry picked from commit 5f0769a) Co-authored-by: Nathan M <nathanmaynes@gmail.com>
* [3.9] bpo-41979: Accept star-unpacking on with-item targets (GH-22611) ↵Batuhan Taskaya2020-10-091-1/+7
| | | | | | | (GH-22612) Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com> Automerge-Triggered-By: @pablogsal
* [3.9] bpo-41970: Avoid test failure in test_lib2to3 if the module is already ↵Karthikeyan Singaravelan2020-10-091-2/+2
| | | | | | | imported (GH-22595) (GH-22609) (cherry picked from commit 4a9f82f50d957b6cf3fd207de8b583d9137316b8) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-41944: No longer call eval() on content received via HTTP in the CJK ↵Miss Skeleton (bot)2020-10-061-14/+8
| | | | | | | codec tests (GH-22566) (cherry picked from commit 2ef5caa58febc8968e670e39e3d37cf8eef3cab8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) (#22567)Miss Skeleton (bot)2020-10-051-0/+2
| | | | | | | Call urllib.request.urlcleanup() to reset the global urllib.request._opener. (cherry picked from commit 1fce240d6c4b2b2cc17a86e88c65169e15b9feeb) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.9] bpo-41909: Enable previously disabled recursion checks. (GH-22536) ↵Serhiy Storchaka2020-10-041-0/+10
| | | | | | | | | | | | | | | (GH-22550) Enable recursion checks which were disabled when get __bases__ of non-type objects in issubclass() and isinstance() and when intern strings. It fixes a stack overflow when getting __bases__ leads to infinite recursion. Originally recursion checks was disabled for PyDict_GetItem() which silences all errors including the one raised in case of detected recursion and can return incorrect result. But now the code uses PyDict_GetItemWithError() and PyDict_SetDefault() instead. (cherry picked from commit 9ece9cd65cdeb0a1f6e60475bbd0219161c348ac)
* [3.9] bpo-41840: Report module-level globals as both local and global in the ↵Pablo Galindo2020-10-031-2/+16
| | | | | | | symtable module (GH-22391). (GH-22528) (cherry picked from commit fb0a4651f1be4ad936f8277478f73f262d8eeb72) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>