Commit graph

114529 commits

Author SHA1 Message Date
Steve Dower 4114bcc9ef
gh-96577: Fixes buffer overrun in _msi module (GH-96633) 2022-09-07 18:01:35 +01:00
Raymond Hettinger 3eaf70d836
GH-96465: Cache hashes for Fraction instances (GH-96483) 2022-09-07 10:31:50 -05:00
Irit Katriel 0cd992c000
gh-88057: in compile.c, assertion that stackdepth is alway >=0 is missing in one place (GH-96513) 2022-09-07 14:01:57 +01:00
Michael Droettboom dde15f5879
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
2022-09-07 04:51:50 -07:00
Nikita Sobolev 2fd7246e97
gh-96641: Do not expose KeyWrapper in _functoolsmodule.c (gh-96642) 2022-09-07 20:13:07 +09:00
Brandt Bucher 0d04b8d9e1
GH-91432: Remove the iterator_exhausted_no_error label (GH-96517) 2022-09-06 21:07:20 -07:00
Dennis Sweeney 56d9cf7fc8
gh-96538: Fix refleak in _bisectmodule.c (gh-96619) 2022-09-06 19:37:18 -04:00
Irit Katriel 147eb723b2
gh-96628: remove deprecated and ignored arg of sysconfig.is_python_build() (GH-96629) 2022-09-07 00:24:34 +01:00
Michael Droettboom 05692c67c5
gh-96611: Fix error message for invalid UTF-8 in mid-multiline string (#96623) 2022-09-07 00:12:16 +01:00
Kumar Aditya 67444902a0
GH-96572: fix use after free in trace refs build mode (#96618) 2022-09-06 11:02:41 -07:00
Mark Shannon 95e271b226
GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613) 2022-09-06 17:37:47 +01:00
Jelle Zijlstra f0d9136c69
gh-96478: Fix new test when run in refleak mode (#96615)
./python.exe -m test -R : test.test_typing would fail, apparently
because the dictionary used in the @patch decorator was modified.
2022-09-06 09:33:09 -07:00
Mark Shannon 222f10ca2d
GH-96569: Add two NULL checks to avoid undefined behavior. (GH-96585) 2022-09-06 16:45:43 +01:00
Brandt Bucher cd0ff9bd14
GH-93911: Fix LOAD_ATTR_PROPERTY caches (GH-96519) 2022-09-06 12:11:38 +01:00
Nikita Sobolev f177f6f29b
gh-96478: Test @overload on C functions (#96479)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-09-05 14:35:05 -07:00
Jonathon Reinhart 30878a7735
argparse: Remove unused name variable when handling ArgumentTypeError (#96549)
This removes the unused `name` variable in the block where `ArgumentTypeError` is handled.

`ArgumentTypeError` errors are handled by showing just the string of the exception; unlike `ValueError`, the name (`__name__`) of the function is not included in the error message.

Fixes #96548
2022-09-05 14:32:23 -07:00
Irit Katriel c4999f261f
[doc] Update example in traceback doc (GH-96600)
This Monty Python reference is of-its-time. It could seem inappropriate in the context of today's sensibilities around mental health.

Automerge-Triggered-By: GH:iritkatriel
2022-09-05 14:30:51 -07:00
Jason R. Coombs 52fe7e50c9
gh-93963: Remove ResourceReaderDefaultsTests (GH-96598)
Automerge-Triggered-By: GH:jaraco
2022-09-05 12:37:51 -07:00
Steve Dower 80a9bd2e94
gh-96559: Fixes Windows launcher handling of defaults using old-style tags, and adds What's New section (GH-96595) 2022-09-05 20:06:30 +01:00
Ned Deily 991b3712a1
Add upstream openssl 1.1.1q patch for trivial build error on macOS (GH-96594) 2022-09-05 14:37:24 -04:00
Shantanu 200c9a8da0
gh-92986: Fix ast.unparse when ImportFrom.level is None (#92992)
This doesn't happen naturally, but is allowed by the ASDL and compiler.
We don't want to change ASDL for backward compatibility reasons
(#57645, #92987)
2022-09-05 20:14:50 +03:00
Nikita Sobolev 2c7d2e8d46
gh-96587: Raise SyntaxError for PEP654 on older feature_version (#96588) 2022-09-05 17:54:09 +01:00
Vinay Sajip a9d58feccf
gh-84095: Fill documentation gap regarding user-defined objects. (GH-96574) 2022-09-05 07:47:47 +01:00
Dennis Sweeney 9e35d05422
gh-96538: Move some type-checking out of bisect.bisect() loops (GH-96539) 2022-09-05 01:02:29 -04:00
Pamela Fox a0ad63e70e
gh-93973: Add all_errors to asyncio.create_connection (#93974)
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2022-09-04 18:33:50 -07:00
Dennis Sweeney ac18665472
ceval.c's GETITEM should have asserts, not set exceptions (GH-96518) 2022-09-04 19:00:24 -04:00
Erlend E. Aasland 9e55685782
Docs: alphabetically order sqlite3.Cursor attrs (#96565) 2022-09-04 23:34:45 +02:00
Mark Dickinson b126196838
gh-95778: Correctly pre-check for int-to-str conversion (#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>
2022-09-04 09:21:18 -07:00
Ikko Ashimine 6adb89f50a
no-issue: Fix typo in 3.11.0a7.rst (gh-96547)
accross -> across
2022-09-04 22:17:26 +09:00
Sergey B Kirpichev 8464b754c4
gh-68163: Correct conversion of Rational instances to float (GH-25619)
* 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>
2022-09-04 13:15:59 +01:00
Charlie Zhao 9b9394df5f
gh-93884: Improve test coverage of PyNumber_ToBase (GH-93932)
Link to #93884 
* Test with some large negative and positive values(out of range of a longlong,i.e.[-2\*\*63, 2\*\*63-1])
* Test with objects of non-int type

Automerge-Triggered-By: GH:mdickinson
2022-09-04 03:37:04 -07:00
Gregory P. Smith 69bb83c2bf
gh-95778: remove unneeded doc note on float.as_integer_ratio (#96553)
Per mdickinson@'s comment on the main branch PR.
2022-09-04 00:04:36 -07:00
Mehrdad Moradizadeh af6359dd5c
doc typo: spell limitation (#96542) 2022-09-03 23:23:32 -07:00
Vinay Sajip ac4ddab405
gh-90195: Unset logger disabled flag when configuring it. (GH-96530) 2022-09-03 13:38:38 +01:00
Vinay Sajip e5823bf9b5
gh-89087: Update logging.QueueHandler documentation to clarify record… (GH-96527) 2022-09-03 13:02:19 +01:00
Terry Jan Reedy 837ce6460d
gh-75500: Update idlelib/help.html (#96523) 2022-09-03 03:38:57 -04:00
Kumar Aditya 6dab8c95bd
GH-96458: Statically initialize utf8 representation of static strings (#96481) 2022-09-02 23:43:08 -07:00
Serhiy Storchaka 16c6759b37
gh-45108: Improve docstring and testing of ZipFile.testfile() (GH-96233) 2022-09-03 08:58:25 +03:00
Alexandru Mărășteanu 57b6110361
[Enum] bump version tag on HTTP status category indicators (GH-96508) 2022-09-02 13:11:18 -07:00
Cheryl Sabella ccce9b77e1
bpo-30419: DOC: Update missing information in bdb docs (#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>
2022-09-02 13:22:42 -04:00
siph 2a9e4e4d73
gh-95180: Add TaskGroup and Runner to AsyncIO API Index (#95189)
Also rearrange some items in the list.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-09-02 09:36:45 -07:00
Gregory P. Smith 511ca94520
gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96499)
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.

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#). Much of that text wound up in the Issue. Backports PRs already exist. See the issue for links.
2022-09-02 09:35:08 -07:00
Raymond Hettinger 656167db81
Allow whitespace around a slash in fraction string inputs (GH-96496) 2022-09-02 11:10:58 -05:00
Erlend E. Aasland 91f40f3f78
gh-96168: Improve sqlite3 dict_factory example (#96457)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-09-01 23:47:59 +02:00
Irit Katriel 4c72517cad
gh-93554: Conditional jump opcodes only jump forward (GH-96318) 2022-09-01 21:36:47 +01:00
Irit Katriel a91f25577c
gh-96455: update example in exception_handling_notes.txt to the 3.11RC bytecode (GH-96456) 2022-09-01 14:21:39 +01:00
Irit Katriel 894cafd9a5
gh-93678: apply remove_redundant_jumps in optimize_cfg (GH-96274) 2022-09-01 11:03:52 +01:00
Gregory P. Smith e93d1bda77
gh-96143: subprocess API %s/universal_newlines=/text=/g. (GH-96468)
minor missed test cleanup to use the modern API from the big review.

Automerge-Triggered-By: GH:gpshead
2022-09-01 02:47:40 -07:00
Anh71me 0cd33e11fe
GH-96079 Fix missing field name for _AnnotatedAlias (#96080) 2022-08-31 16:02:24 -07:00
Piotr Kaznowski 615537e62f
gh-96408: Document difference between set-like view and sets. (GH-96439) 2022-08-31 16:23:52 -05:00