Commit graph

48918 commits

Author SHA1 Message Date
Miss Islington (bot)
6daff06fc2
gh-94808: Coverage: Test uppercase string literal prefixes (GH-95925)
(cherry picked from commit f00383ec9b)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-25 01:21:58 -07:00
Miss Islington (bot)
a386d1341c
gh-96052: codeop: fix handling compiler warnings in incomplete input (GH-96132)
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 426d72e7dd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-09-25 01:21:00 -07:00
Miss Islington (bot)
4d1de87042
gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961)
(cherry picked from commit db39050396)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-09-25 01:20:45 -07:00
Miss Islington (bot)
fe8db634d4
gh-97527: IDLE: protect macosx Tk() call when no GUI (GH-97530)
Only call tkinter.tk and its follow-up code in _init_tk_type when requires('gui')
does not raise.  This function can be called as an unintended side-effect of
calling other idlelib code as part of tests on macOS without a GUI enabled.
(cherry picked from commit 9704f8da33)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-09-24 15:09:08 -07:00
Miss Islington (bot)
6642d8a0f9
GH-85760: Fix race in calling process_exited callback too early (GH-97009)
(cherry picked from commit 282edd7b2a)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-09-22 10:24:54 -07:00
Miss Islington (bot)
6a646dd1ff
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97018)
(cherry picked from commit 8fd2c3b75b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-09-22 10:17:53 -07:00
Miss Islington (bot)
773dbb9e3a
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)
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 24e0379624)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-22 09:58:35 -07:00
Łukasz Langa
d35b9d0a60
[3.11] gh-96954: Add tests for unicodedata.name/lookup (GH-96955) (GH-96991)
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 5a32eeced2)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-09-21 16:07:07 +02:00
Miss Islington (bot)
46f791d263
gh-90808: add more examples to test_sched.test_priority (GH-31144)
(cherry picked from commit 57463d43dc)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 19:03:13 -07:00
Miss Islington (bot)
e066c6a56b
gh-95950: Add a test for both csv.Dialect and kwargs (GH-95951)
(cherry picked from commit 1c01bd28a0)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 18:37:10 -07:00
Miss Islington (bot)
2a5e333736
gh-96478: Test @overload on C functions (GH-96479)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit f177f6f29b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 18:36:23 -07:00
Miss Islington (bot)
a670c65f14
[Enum] fix typos (GH-96285)
(cherry picked from commit 58882640d6)

Co-authored-by: wim glenn <wim.glenn@gmail.com>
2022-09-20 16:55:52 -07:00
Miss Islington (bot)
fd118a0850
gh-95591: [Enum] use _FlagTests base class (GH-96475)
(cherry picked from commit 9b58eaf98c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 16:34:14 -07:00
Brandt Bucher
0e61d2b557
[3.11] GH-95921: Fix positions for some chained comparisons (GH-96968) (GH-96973)
(cherry picked from commit dfc73b5724)

Automerge-Triggered-By: GH:brandtbucher
2022-09-20 14:56:38 -07:00
Miss Islington (bot)
32d80decbf
GH-96864: Check for error between line and opcode events (GH-96880)
(cherry picked from commit c10e33ac11)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-09-20 10:49:01 -07:00
Miss Islington (bot)
9b789e5828
[3.11] gh-96861: Check for unset sys.executable during venv creation. (GH-96887) (GH-96919)
(cherry picked from commit 2cd70ffb3f)
2022-09-18 21:58:46 +01:00
Miss Islington (bot)
98b81c2ac3
gh-87179: Fix more IDLE class headers (GH-96899)
Remove unneeded '(object)' and '()'.
(cherry picked from commit aa671b48d6)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-09-17 15:15:23 -07:00
Miss Islington (bot)
d39fce0f03
Fix ResourceWarning in test.test_frame (GH-96831)
(cherry picked from commit 303bd88047)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-09-16 17:03:57 -07:00
Christian Heimes
bc337a7766
[3.11] gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006) (GH-96034) (GH-96038)
- On WASI `ENOTCAPABLE` is now mapped to `PermissionError`.
- The `errno` modules exposes the new error number.
- `getpath.py` now ignores `PermissionError` when it cannot open landmark
  files `pybuilddir.txt` and `pyenv.cfg`.
2022-09-13 13:00:45 +02:00
Christian Heimes
4958820032
[3.11] gh-95853: Add script to automate WASM build (GH-95828, GH-95985, GH-96045, GH-96389, GH-96744) (GH-96749)
Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.
2022-09-13 12:06:39 +02:00
Miss Islington (bot)
390123b412
[3.11] gh-96320: WASI socket fixes (GH-96388) (GH-#96748)
- ignore missing functions in ``socket.__repr__``
- bundle network files with assets
2022-09-13 12:05:25 +02:00
Pablo Galindo
ed7c3ff156
Python 3.11.0rc2 2022-09-11 20:23:30 +01:00
Miss Islington (bot)
335bd1ee8b
gh-94972: document that shield users need to keep a reference to their task (GH-96724)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
(cherry picked from commit 6281affee6)

Co-authored-by: Hendrik Makait <hendrik.makait@gmail.com>
2022-09-10 08:03:35 -07:00
Miss Islington (bot)
fecda02eb6
gh-96710: Make the test timing more lenient for the int/str DoS regression 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 11e3548fd1)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-09-09 13:17:04 -07:00
Mark Shannon
5586da65e2
[3.11] GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643) (#96688)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
(cherry picked from commit aa3b4cf779)
2022-09-09 09:24:44 -07:00
Jelle Zijlstra
7bfb11de68
[3.11] io: Add missing f (#96701) 2022-09-09 10:28:26 +01:00
Miss Islington (bot)
99919d4e8a
gh-96352: Set AttributeError context in _PyObject_GenericGetAttrWithDict (GH-96353)
(cherry picked from commit b9634ac776)

Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
2022-09-08 04:43:52 -07:00
Miss Islington (bot)
0c443c2315
GH-94808: Test __build_class__ inside non-dict __builtins__ (GH-95932) (#96004)
(cherry picked from commit 3adb4d864b)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-08 12:17:18 +01:00
Miss Islington (bot)
ae819ca6fd
[3.11] gh-68163: Correct conversion of Rational instances to float (GH-25619) (#96556)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2022-09-08 12:03:53 +01:00
Miss Islington (bot)
ffafa9b91d
gh-96268: Fix loading invalid UTF-8 (GH-96270)
This makes tokenizer.c:valid_utf8 match stringlib/codecs.h:decode_utf8.

It also fixes an off-by-one error introduced in 3.10 for the line number when the tokenizer reports bad UTF8.
(cherry picked from commit 8bc356a7dd)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-07 14:49:17 -07:00
Miss Islington (bot)
295f510f5a
gh-94808: Improve coverage of _PyBytes_FormatEx (GH-95895)
There were two specific areas not covered:

- %(name) syntax
- %*s syntax

Automerge-Triggered-By: GH:iritkatriel
(cherry picked from commit dde15f5879)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-07 05:18:33 -07:00
Miss Islington (bot)
bb0dab5c48
gh-96611: Fix error message for invalid UTF-8 in mid-multiline string (GH-96623)
(cherry picked from commit 05692c67c5)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-06 16:40:17 -07:00
Mark Shannon
26dc4dfac3
[3.11] GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613) (#96617)
(cherry picked from commit 95e271b226)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-09-06 18:42:41 +01:00
Batuhan Taskaya
a0848d169b
[3.11] gh-92986: Fix ast.unparse when ImportFrom.level is None (GH-92992) (GH-96593)
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 200c9a8da0)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-09-06 13:23:26 +03:00
Miss Islington (bot)
08d8058b79
gh-96559: Fixes Windows launcher handling of defaults using old-style tags, and adds What's New section (GH-96595)
(cherry picked from commit 80a9bd2e94)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-09-05 15:13:24 -07:00
Miss Islington (bot)
8a776d1d51
gh-95778: Correctly pre-check for int-to-str conversion (GH-96537)
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 b126196838)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-09-04 09:45:02 -07:00
Vinay Sajip
f255820626
[3.11] gh-90195: Unset logger disabled flag when configuring it. (GH-96530) (GH-96532) 2022-09-03 15:10:50 +01:00
Miss Islington (bot)
bc06f5c5f7
gh-75500: Update idlelib/help.html (GH-96523) (#96524)
(cherry picked from commit 837ce6460d)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-09-03 10:57:07 +01:00
Miss Islington (bot)
02c59bebf7
bpo-30419: DOC: Update missing information in bdb docs (GH-1687)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit ccce9b77e1)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2022-09-02 10:48:26 -07:00
Gregory P. Smith
f8b71da9aa
[3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500)
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 511ca94520

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#).
2022-09-02 09:48:57 -07:00
Ethan Furman
8f58db2279
[3.11] [Enum] fix check in _test_simple_enum (GH-96435)
The builtin `property` is not a callable, so was failing the check in
`_test_simple_enum` causing a match failure; this adds `property` to the
bypass list.

Co-authored-by: Alexandru Mărășteanu <alexei@users.noreply.github.com>
2022-08-30 12:39:03 -07:00
Miss Islington (bot)
2e9f29e6a6
GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705) (#96395)
(cherry picked from commit e5b2453e61)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-30 12:00:21 +01:00
Miss Islington (bot)
126ec34558
gh-90467: StreamReaderProtocol - add strong reference to created task (GH-96323) (#96344)
(cherry picked from commit e860e521ec)

Co-authored-by: Kirill <iam@python273.pw>

Co-authored-by: Kirill <iam@python273.pw>
2022-08-30 11:59:32 +01:00
Miss Islington (bot)
16d8948c31
gh-96385: Correctly raise error on [*T, *V] substitution (GH-96386) (#96407)
(cherry picked from commit 75177358a6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-08-30 11:58:54 +01:00
Miss Islington (bot)
103f26f282
[3.11] gh-89047: Fix msecs computation so you never end up with 1000 msecs. (GH-96340) (GH-96341) 2022-08-27 15:09:54 +01:00
Miss Islington (bot)
b7ea2b8358
[3.11] gh-92007: Handle elevation errors in NTEventLogHandler more grace… (GH-96322) (GH-96337) 2022-08-27 13:08:14 +01:00
Miss Islington (bot)
0bc0b732ee
fix threading.Event.isSet() docstring (GH-96297)
fixes gh-96296
(cherry picked from commit e534440510)

Co-authored-by: Daniel Giger <danielg3432@gmail.com>
2022-08-26 22:32:03 -07:00
Miss Islington (bot)
acd7841aa4
Port regression test for issue GH-93592 (GH-96208) (GH-96313) 2022-08-26 16:02:36 +01:00
Miss Islington (bot)
f51216df07
gh-96021: Explicitly close the IsolatedAsyncioTestCase runner in tests (GH-96135)
Tests for IsolatedAsyncioTestCase.debug() rely on the runner be closed
in __del__. It makes tests depending on the GC an unreliable on other
implementations. It is better to close the runner explicitly even if
currently there is no a public API for this.
(cherry picked from commit 4de06e3cc0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-08-24 21:53:39 -07:00
Miss Islington (bot)
915ee9ed43
gh-95243: Mitigate the race condition in testSockName (GH-96173)
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 df11012697)

Co-authored-by: Ross Burton <ross.burton@arm.com>
2022-08-24 19:03:29 -07:00