summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-51511: Note that codecs.open()'s encoding parameter affects automatic ↵Miss Islington (bot)2022-10-211-1/+2
| | | | | | | conversion to binary mode (GH-94370) (cherry picked from commit d9407b174c81fda33e6c09a6f988c9a7cb8368af) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
* [3.10] gh-98517: Fix buffer overflows in _sha3 module (#98519)Theo Buehler2022-10-211-0/+9
| | | | | | | | | | This is a port of the applicable part of XKCP's fix [1] for CVE-2022-37454 and avoids the segmentation fault and the infinite loop in the test cases published in [2]. [1]: https://github.com/XKCP/XKCP/commit/fdc6fef075f4e81d6b1bc38364248975e08e340a [2]: https://mouha.be/sha-3-buffer-overflow/ Regression test added by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* gh-96035: Make urllib.parse.urlparse reject non-numeric ports (GH-98273)Miss Islington (bot)2022-10-201-3/+7
| | | | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 6f15ca8c7afa23e1adc87f2b66b958b721f9acab) Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.com>
* gh-98174: Handle EPROTOTYPE under macOS in ↵Miss Islington (bot)2022-10-171-2/+12
| | | | | | | | test_sendfile_fallback_close_peer_in_the_middle_of_receiving (GH-98316) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> (cherry picked from commit 3e82ad05b18d004e4d01fdb643344d6a2bf11900) Co-authored-by: fancidev <fancidev@gmail.com>
* gh-95971: Turn @writes_bytecode_files to skip when not running (GH-95972)Miss Islington (bot)2022-10-151-1/+1
| | | | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 07b5c4699e64eb30c3bdcb1275c167e675d37423) Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
* gh-95731: Fix module docstring extraction in pygettext (GH-95732)Miss Islington (bot)2022-10-151-0/+20
| | | | | (cherry picked from commit 120b4ab2b68aebf96ce0de243eab89a25fc2d282) Co-authored-by: Jakub Kuczys <me@jacken.men>
* gh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip ↵Miss Islington (bot)2022-10-141-4/+4
| | | | | | | when they do not impact path resolution (GH-98259) (cherry picked from commit 2fe44f728afa2dd506c304641f0481d6813d1dbd) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)Miss Islington (bot)2022-10-131-0/+20
| | | | | | | Signed-off-by: Christoph Hamsen <hamsen.christoph@posteo.de> Co-authored-by: July Tikhonov <july.tikh@gmail.com> (cherry picked from commit c9ed0327a9c741a1808926b409df29467baf303a) Co-authored-by: Christoph Hamsen <37963496+xopham@users.noreply.github.com>
* [3.10] gh-94808: Cover `PyObject_PyBytes` case with custom `__bytes__` ↵Nikita Sobolev2022-10-091-0/+20
| | | | | | | | | method (GH-96610) (#98121) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>. Co-authored-by: Nikita Sobolev <mail@sobolevn.me> (cherry picked from commit e39ae6bef2c357a88e232dcab2e4b4c0f367544b)
* [3.10] Add more syslog tests (GH-97953). (GH-98101)Serhiy Storchaka2022-10-093-6/+96
| | | | (cherry picked from commit cae7d1d7a713f8267daf5e4f2fff5cb1dad02c7c)
* gh-92886: make test_ast pass with -O (assertions off) (GH-98058)Miss Islington (bot)2022-10-081-1/+1
| | | | | | | | -O does not strip docstrings. Automerge-Triggered-By: GH:iritkatriel (cherry picked from commit 27ce45d8e105d0c9f9286c3cab830590d4c7cea3) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-92886: make test_coroutines pass with -O (assertions off) (GH-98060)Miss Islington (bot)2022-10-081-1/+1
| | | | | | Automerge-Triggered-By: GH:iritkatriel (cherry picked from commit 45f21472daad3934baf364c3100063ecc51c6e04) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.10] gh-94808: Cover `%p` in `PyUnicode_FromFormat` (GH-96677) (#98032)Miss Islington (bot)2022-10-071-0/+19
| | | | | | Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 72c166add89a0cd992d66f75ce94eee5eb675a99)
* GH-96073: Fix wild replacement in inspect.formatannotation (GH-96074)Miss Islington (bot)2022-10-073-0/+21
| | | | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit d5fea01d9d439b1638cd8e5db19c33909841d86f) Co-authored-by: Anh71me <iyumelive@gmail.com>
* gh-65496: Correct wording on csv's skipinitialspace argument (GH-96170)Miss Islington (bot)2022-10-071-0/+5
| | | | | (cherry picked from commit 676d8ef3806758bcd1d3fd84a746c8a9b64480d0) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
* [3.10] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK ↵Miss Islington (bot)2022-10-061-0/+22
| | | | | | | | | | | | | (GH-97944) (#97967) The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls. Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a segfault if cpython is built with the macOS 13 SDK but run on an earlier version of macOS. Prevent this by adding runtime support for detection of these system calls ("weaklinking") as is done for other newer syscalls on macOS. (cherry picked from commit 6d0a0191a4e5477bd843e62c24d7f3bcad4fd5fc) Co-authored-by: Ned Deily <nad@python.org>
* gh-95196: Disable incorrect pickling of the C implemented classmethod ↵Miss Islington (bot)2022-10-051-0/+18
| | | | | | | descriptors (GH-96383) (cherry picked from commit 77f0249308de76401bf4f3c6a057789c92f862d1) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-97825: fix AttributeError when calling ↵Miss Islington (bot)2022-10-051-0/+6
| | | | | | | | subprocess.check_output(input=None) with encoding or errors args (GH-97826) * fix AttributeError, add unit test (cherry picked from commit db64fb9bbe92b212db7dd173f787ea3607ae971a) Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
* [3.10] gh-97728: Argument Clinic: Fix uninitialized variable in the ↵Serhiy Storchaka2022-10-031-6/+6
| | | | | | | | Py_UNICODE converter (GH-97729) (GH-97760) It affects function os.system() on Windows and Windows-specific modules winreg, _winapi, _overlapped, and _msi. (cherry picked from commit 0ee9619a4cba58730c45e65d22288fadbf7680de)
* gh-96819: multiprocessing.resource_tracker: check if length of pipe write <= ↵Miss Islington (bot)2022-10-031-0/+8
| | | | | | | | 512 (GH-96890) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> (cherry picked from commit 19ca114645bd8796cf4094e152b1fa9944da473d) Co-authored-by: Koki Saito <49419225+saito828koki@users.noreply.github.com>
* gh-97591: In `Exception.__setstate__()` acquire strong references before ↵Miss Islington (bot)2022-10-021-0/+25
| | | | | | | calling `tp_hash` slot (GH-97700) (cherry picked from commit d63943860974f232b5f027dc6535d25d1b4d8fc0) Co-authored-by: Ofey Chan <ofey206@gmail.com>
* GH-97592: Fix crash in C remove_done_callback due to evil code (GH-97660)Miss Islington (bot)2022-09-301-0/+15
| | | | | | Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called. (cherry picked from commit 63780f4599acc2c5ee8af5f37ab76c162ad21065) Co-authored-by: Guido van Rossum <guido@python.org>
* gh-97616: list_resize() checks for integer overflow (GH-97617)Miss Islington (bot)2022-09-281-0/+13
| | | | | | | | | | | Fix multiplying a list by an integer (list *= int): detect the integer overflow when the new allocated length is close to the maximum size. Issue reported by Jordan Limor. list_resize() now checks for integer overflow before multiplying the new allocated length by the list item size (sizeof(PyObject*)). (cherry picked from commit a5f092f3c469b674b8d9ccbd4e4377230c9ac7cf) Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-97545: Make Semaphore run faster. (GH-97549)Miss Islington (bot)2022-09-261-2/+1
| | | | | (cherry picked from commit 68c46ae68b6e0c36a12e37285fff9ce0782ed01e) Co-authored-by: Cyker Way <cykerway@gmail.com>
* gh-96848: Fix -X int_max_str_digits option parsing (GH-96988)Miss Islington (bot)2022-09-261-0/+2
| | | | | | | | Fix command line parsing: reject "-X int_max_str_digits" option with no value (invalid) when the PYTHONINTMAXSTRDIGITS environment variable is set to a valid limit. (cherry picked from commit 41351662bcd21672d8ccfa62fe44d72027e6bcf8) Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-94808: Coverage: Test uppercase string literal prefixes (GH-95925)Miss Islington (bot)2022-09-251-0/+7
| | | | | (cherry picked from commit f00383ec9bb9452fd9d5f5003f123e68fc4a71d8) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-96052: codeop: fix handling compiler warnings in incomplete input (GH-96132)Miss Islington (bot)2022-09-251-0/+20
| | | | | | | | | Previously codeop.compile_command() emitted compiler warnings (SyntaxWarning or DeprecationWarning) and raised a SyntaxError for incomplete input containing a potentially incorrect code. Now it always returns None for incomplete input without emitting any warnings. (cherry picked from commit 426d72e7ddb0af5cf851914ac75127186dd1ff04) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961)Miss Islington (bot)2022-09-255-38/+38
| | | | | (cherry picked from commit db39050396a104c73d0da473a2f00a62f9dfdfaa) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)Miss Islington (bot)2022-09-221-0/+100
| | | | | | | | | | | The main problem was that an unluckily timed task cancellation could cause the semaphore to be stuck. There were also doubts about strict FIFO ordering of tasks allowed to pass. The Semaphore implementation was rewritten to be more similar to Lock. Many tests for edge cases (including cancellation) were added. (cherry picked from commit 24e03796248ab8c7f62d715c28156abe2f1c0d20) Co-authored-by: Cyker Way <cykerway@gmail.com>
* [3.10] gh-96954: Add tests for unicodedata.name/lookup (GH-96955) (GH-96992)Łukasz Langa2022-09-211-0/+7
| | | | | | | | | | They were undertested, and since GH-96954 might involve a rewrite of this part of the code we want to ensure that there won't be any behavioral change. Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> (cherry picked from commit 5a32eeced2c537c13613dd4ff5b2767a37037294) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
* gh-90808: add more examples to `test_sched.test_priority` (GH-31144)Miss Islington (bot)2022-09-211-4/+17
| | | | | (cherry picked from commit 57463d43dc4277a1f4d33bd003567e947c937cf5) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.10] GH-95921: Fix positions for some chained comparisons (GH-96968) ↵Brandt Bucher2022-09-201-0/+32
| | | | | | | (GH-96974) (cherry picked from commit dfc73b57247aac575c83055d960c03bdc28b51fd) Automerge-Triggered-By: GH:brandtbucher
* [3.10] GH-96864: Check for error between line and opcode events (GH-96969)Brandt Bucher2022-09-201-0/+14
| | | (cherry picked from commit c10e33ac119d96c4d88d5ae8b59e65a76ae0ad3c)
* [3.10] gh-68966: Make mailcap refuse to match unsafe filenames/types/params ↵Miss Islington (bot)2022-09-201-2/+6
| | | | | | | | | | (GH-91993) (GH-93543) * gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993) (cherry picked from commit b9509ba7a9c668b984dab876c7926fe1dc5aa0ba) * Add a What's New entry for 3.10.8. Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-96710: Make the test timing more lenient for the int/str DoS regression ↵Miss Islington (bot)2022-09-091-6/+8
| | | | | | | | | | | | test. (GH-96717) A regression would still absolutely fail and even a flaky pass isn't harmful as it'd fail most of the time across our N system test runs. Windows has a low resolution timer and CI systems are prone to odd timing so this just gives more leeway to avoid flakiness. (cherry picked from commit 11e3548fd1d3445ccde971d613633b58d73c3016) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705)Miss Islington (bot)2022-09-081-0/+19
| | | | | (cherry picked from commit e5b2453e61ba5376831093236d598ef5f9f1de61) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-96352: Set AttributeError context in _PyObject_GenericGetAttrWithDict ↵Miss Islington (bot)2022-09-081-0/+5
| | | | | | | (GH-96353) (cherry picked from commit b9634ac776c24bc4d4a57859d884a94cdfe16043) Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
* gh-96611: Fix error message for invalid UTF-8 in mid-multiline string (GH-96623)Miss Islington (bot)2022-09-061-0/+12
| | | | | (cherry picked from commit 05692c67c51b78a5a5a7bb61d646519025e38015) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-92986: Fix ast.unparse when ImportFrom.level is None (GH-92992)Miss Islington (bot)2022-09-051-0/+6
| | | | | | | | This doesn't happen naturally, but is allowed by the ASDL and compiler. We don't want to change ASDL for backward compatibility reasons (GH-57645, GH-92987) (cherry picked from commit 200c9a8da0e2b892c476807e986009c01327e781) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* [3.10] gh-95778: Correctly pre-check for int-to-str conversion (GH-96537) ↵Gregory P. Smith2022-09-041-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#96563) Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =) The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact. The justification for the current check. The C code check is: ```c max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10 ``` In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is: $$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$ From this it follows that $$\frac{M}{3L} < \frac{s-1}{10}$$ hence that $$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$ So $$2^{L(s-1)} > 10^M.$$ But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check. <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org> (cherry picked from commit b126196838bbaf5f4d35120e0e6bcde435b0b480) Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* gh-68163: Correct conversion of Rational instances to float (GH-25619) ↵Miss Islington (bot)2022-09-041-0/+28
| | | | | | | | | | | | (GH-96557) * gh-68163: Correct conversion of Rational instances to float Also document that numerator/denominator properties are instances of Integral. Co-authored-by: Mark Dickinson <dickinsm@gmail.com> (cherry picked from commit 8464b754c4168586b99e2135ccd2567e025625a9) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [3.10] gh-90195: Unset logger disabled flag when configuring it. (GH-96530) ↵Vinay Sajip2022-09-031-2/+32
| | | | (GH-96533)
* [3.10] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96501)Gregory P. Smith2022-09-029-2/+224
| | | | | | | | | | | | | | | | | Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds. This PR comes fresh from a pile of work done in our private PSRT security response team repo. This backports https://github.com/python/cpython/pull/96499 aka 511ca9452033ef95bc7d7fc404b8161068226002 Signed-off-by: Christian Heimes [Red Hat] <christian@python.org> Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org> Reviews via the private PSRT repo via many others (see the NEWS entry in the PR). <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
* gh-95950: Add a test for both `csv.Dialect` and `kwargs` (GH-95951)Miss Islington (bot)2022-08-291-0/+28
| | | | | (cherry picked from commit 1c01bd28a0ec7e46e570a07d970c590b1809f8f1) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.10] gh-89047: Fix msecs computation so you never end up with 1000 msecs. ↵Miss Islington (bot)2022-08-271-0/+8
| | | | (GH-96340) (GH-96342)
* gh-95243: Mitigate the race condition in testSockName (GH-96173)Miss Islington (bot)2022-08-251-2/+13
| | | | | | | | | | | find_unused_port() has an inherent race condition, but we can't use bind_port() as that uses .getsockname() which this test is exercising. Try binding to unused ports a few times before failing. Signed-off-by: Ross Burton <ross.burton@arm.com> (cherry picked from commit df110126971d0271a977ce10779083b3e335b4da) Co-authored-by: Ross Burton <ross.burton@arm.com>
* [3.10] GH-96071: add regression test for GH-96071 (GH-96137) (#96205)Kumar Aditya2022-08-231-0/+14
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-96175: add missing self._localName assignment in `xml.dom.minidom.Attr` ↵Miss Islington (bot)2022-08-231-1/+15
| | | | | | | | | | (GH-96176) X-Ref: https://github.com/python/typeshed/pull/8590GH-discussion_r951473977 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 58f6953d6d3fe20d972bfa2f6e982206adcf1353) Co-authored-by: Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
* [3.10] GH--93592: Fix frame chain when throwing exceptions into coroutines ↵Kristján Valur Jónsson2022-08-231-0/+24
| | | | (GH-95207)
* [3.10] gh-94996: Disallow lambda pos only params with feature_version < (3, ↵Shantanu2022-08-121-0/+7
| | | | | | | | | 8) (GH-95934) (GH-95938) (cherry picked from commit a965db37f27ffb232312bc13d9a509f0d93fcd20) Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Automerge-Triggered-By: GH:lysnikolaou