Commit Graph

27203 Commits

Author SHA1 Message Date
Miss Islington (bot) a27c540d20
[3.11] gh-96310: Fix a traceback in argparse when all options in a mutually exclusive group are suppressed (GH-96311) (GH-115768)
Reproducer depends on terminal size - the traceback occurs when there's
an option long enough so the usage line doesn't fit the terminal width.
Option order is also important for reproducibility.

Excluding empty groups (with all options suppressed) from inserts
fixes the problem.
(cherry picked from commit 5f7df88821)

Co-authored-by: Daniel Mach <daniel.mach@suse.com>
2024-02-21 18:20:08 +02:00
Miss Islington (bot) 6928d5e1f7
[3.11] gh-115399: Document CVE-2023-52425 under "XML vulnerabilities" (GH-115400) (GH-115761)
Doc/library/xml.rst: Document CVE-2023-52425 under "XML vulnerabilities"
(cherry picked from commit fbd40ce46e)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2024-02-21 12:43:16 +01:00
Serhiy Storchaka 9068c8c614
[3.11] gh-115712: Support CSV dialects with delimiter=' ' and skipinitialspace=True (GH-115721) (GH-115729) (GH-115738)
(cherry picked from commit 5ea86f496a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
(cherry picked from commit 937d282150)
2024-02-20 19:09:10 +00:00
Miss Islington (bot) 142711a31d
[3.11] gh-86291: linecache: get module name from __spec__ if available (GH-22908) (GH-115732)
This allows getting source code for the __main__ module when a custom
loader is used.
(cherry picked from commit e976baba99)

Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>
2024-02-20 18:18:16 +00:00
Miss Islington (bot) aff083e8ee
[3.11] Add missed `stream` argument (GH-111775) (#115717)
Add missed `stream` argument (GH-111775)

* Add missed `stream` argument

* Add news
(cherry picked from commit 1ff6c1416b)

Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
2024-02-20 11:36:59 -05:00
Miss Islington (bot) 01c37f1d07
[3.11] gh-114572: Fix locking in cert_store_stats and get_ca_certs (GH-114573) (#115549)
gh-114572: Fix locking in cert_store_stats and get_ca_certs (GH-114573)

* gh-114572: Fix locking in cert_store_stats and get_ca_certs

cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
https://github.com/openssl/openssl/pull/23224 for details.

Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.

* Work around const-correctness problem

* Add missing X509_STORE_get1_objects failure check

* Add blurb
(cherry picked from commit bce693111b)

Co-authored-by: David Benjamin <davidben@google.com>
2024-02-20 16:34:44 +00:00
Miss Islington (bot) f0104d2a2d
gh-115543: Update py.exe to know about Python 3.13 and to install 3.12 by default (GH-115544)
(cherry picked from commit 6cd18c75a4)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-02-19 21:05:04 +00:00
Miss Islington (bot) c02b7ae4dd
[3.11] gh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args() (GH-114180) (GH-115674)
(cherry picked from commit e47ecbd042)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-19 18:20:51 +00:00
Serhiy Storchaka 5dac9c53cd
[3.11] gh-115618: Remove improper Py_XDECREFs in property methods (GH-115619) (GH-115621)
(cherry picked from commit 090dd21ab9)
2024-02-17 21:47:32 +00:00
Miss Islington (bot) cd0a071fdd
[3.11] gh-115596: Fix ProgramPriorityTests in test_os permanently changing the process priority (GH-115610) (GH-115617)
(cherry picked from commit 90dd653a61)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-02-17 19:14:41 +02:00
Kirill Podoprigora ee3d8dcb00
[3.11] gh-107155: Fix help() for lambda function with return annotation (GH-115613)
(cherry picked from commit b9a9e3dd62)
2024-02-17 17:39:48 +02:00
Serhiy Storchaka 6fbc61070f
[3.11] gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986) (GH-115606)
Update _get_hostport to always remove square brackets
from IPv6 addresses. Then add them if needed
in "CONNECT .." and "Host: ".
(cherry picked from commit 465db27cb9)

Co-authored-by: Derek Higgins <derekh@redhat.com>
2024-02-17 14:15:21 +00:00
Serhiy Storchaka 51b974b0ab
[3.11] gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561) (GH-115604)
(cherry picked from commit 664965a1c1)

Co-authored-by: wookie184 <wookie1840@gmail.com>
2024-02-17 13:13:26 +00:00
Miss Islington (bot) 70754d21c2
[3.11] gh-100884: email/_header_value_parser: don't encode list separators (GH-100885) (GH-115593)
ListSeparator should not be encoded. This could happen when a long line
pushes its separator to the next line, which would have been encoded.
(cherry picked from commit 09fab93c3d)

Co-authored-by: Thomas Weißschuh <thomas@t-8ch.de>
2024-02-17 15:01:02 +02:00
Miss Islington (bot) a5eaa14584
[3.11] gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH-99709) (GH-115600)
lseek() always returns 0 for character pseudo-devices like
`/dev/urandom` (for other non-regular files, e.g. `/dev/stdin`, it
always returns -1, to which CPython reacts by raising appropriate
exceptions). They are thus technically seekable despite not having seek
semantics.

When calling read() on e.g. an instance of `io.BufferedReader` that
wraps such a file, `BufferedReader` reads ahead, filling its buffer,
creating a discrepancy between the number of bytes read and the internal
`tell()` always returning 0, which previously resulted in e.g.
`BufferedReader.tell()` or `BufferedReader.seek()` being able to return
positions < 0 even though these are supposed to be always >= 0.

Invariably keep the return value non-negative by returning
max(former_return_value, 0) instead, and add some corresponding tests.
(cherry picked from commit 26800cf25a)

Co-authored-by: 6t8k <58048945+6t8k@users.noreply.github.com>
2024-02-17 14:55:43 +02:00
Jelle Zijlstra c01a4808d3
[3.11] gh-115570: Fix DeprecationWarnings in test_typing (#115571)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-16 19:37:42 +00:00
Miss Islington (bot) 9bb3f56592
[3.11] [3.12] GH-113516: don't set `LDSHARED` when building for WASI (GH-115495) (GH-115496) (GH-115497)
[3.12] GH-113516: don't set `LDSHARED` when building for WASI (GH-115495) (GH-115496)
(cherry picked from commit 0e4f73b8e4)

Co-authored-by: Brett Cannon <brett@python.org>
2024-02-14 17:34:45 -08:00
Donghee Na 1739efc57d
[3.11] gh-112087: Fix reduce logic for the empty reverse iterator for list (gh-115472) 2024-02-14 18:43:39 +00:00
Seth Michael Larson e071b0d558
[3.11] Upgrade bundled libexpat to 2.6.0 (GH-115399) (GH-115468)
Manual backport due to code differences.
2024-02-14 18:29:27 +01:00
Miss Islington (bot) 0e07ebdba4
[3.11] gh-115243: Fix crash in deque.index() when the deque is concurrently modified (GH-115247) (GH-115466)
(cherry picked from commit 671360161f)

Co-authored-by: kcatss <kcats9731@gmail.com>
2024-02-14 17:21:12 +00:00
Miss Islington (bot) c4e8ffb9a1
[3.11] gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440) (#115458)
gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440)
(cherry picked from commit bb791c7728)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-02-14 15:55:48 +00:00
John Belmonte b86fdf2222
[3.11] gh-114563: C decimal falls back to pydecimal for unsupported format strings (GH-114879) (GH-115384)
Immediate merits:
* eliminate complex workarounds for 'z' format support
  (NOTE: mpdecimal recently added 'z' support, so this becomes
  efficient in the long term.)
* fix 'z' format memory leak
* fix 'z' format applied to 'F'
* fix missing 'GH-' format support

Suggested and prototyped by Stefan Krah.

Fixes gh-114563, gh-91060

(cherry picked from commit 72340d15cd)
(cherry picked from commit 09c98e4633)

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-02-13 10:38:06 +02:00
Miss Islington (bot) 21edde17b3
[3.11] gh-115233: Fix an example in the Logging Cookbook (GH-115325) (GH-115355) (GH-115357)
Also add more tests for LoggerAdapter.

Also support stacklevel in LoggerAdapter._log().
(cherry picked from commit 225856ef3e)
(cherry picked from commit 91822018ee)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-12 23:25:47 +02:00
Miss Islington (bot) c568d44a54
[3.11] Remove stray backtick in NEWS entry (GH-115356) (#115363)
Remove stray backtick in NEWS entry (GH-115356)
(cherry picked from commit a82fbc13d0)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2024-02-12 19:30:22 +00:00
Miss Islington (bot) 9b6aba2751
[3.11] Add missing sections to blurbs (GH-114553) (#115337)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-02-12 14:22:41 +00:00
Serhiy Storchaka 5f938c1104
[3.11] gh-115198: Fix support of Docutils >= 0.19 in distutils (GH-115220) 2024-02-12 13:45:22 +02:00
Serhiy Storchaka b9e90031a3
[3.11] [3.12] gh-97959: Fix rendering of routines in pydoc (GH-113941) (GH-115296) (GH-115302)
* Class methods no longer have "method of builtins.type instance" note.
* Corresponding notes are now added for class and unbound methods.
* Method and function aliases now have references to the module or the
  class where the origin was defined if it differs from the current.
* Bound methods are now listed in the static methods section.
* Methods of builtin classes are now supported as well as methods of
  Python classes.
(cherry picked from commit 2939ad02be)
(cherry picked from commit cfb79caaab)
2024-02-11 15:19:43 +00:00
Serhiy Storchaka 7273a58a85
[3.11] gh-115011: Improve support of __index__() in setters of members with unsigned integer type (GH-115029) (GH-115295)
Setters for members with an unsigned integer type now support
the same range of valid values for objects that has a __index__()
method as for int.

Previously, Py_T_UINT, Py_T_ULONG and Py_T_ULLONG did not support
objects that has a __index__() method larger than LONG_MAX.

Py_T_ULLONG did not support negative ints. Now it supports them and
emits a RuntimeWarning.
(cherry picked from commit d9d6909697)
2024-02-11 12:03:48 +00:00
Miss Islington (bot) e72255054b
[3.11] gh-79382: Fix recursive glob() with trailing "**" (GH-115134) (GH-115291)
Trailing "**" no longer allows to match files and non-existing paths in
recursive glob().
(cherry picked from commit aeffc7f895)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-11 11:04:02 +00:00
Miss Islington (bot) 3501eca89e
[3.11] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164) (GH-115289)
Feeding the parser by too small chunks defers parsing to prevent
CVE-2023-52425. Future versions of Expat may be more reactive.
(cherry picked from commit 4a08e7b343)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-11 10:38:04 +00:00
Serhiy Storchaka 115f72b70b
[3.11] gh-115198: Fix test_check_metadata_deprecation in test_distutils (#115200)
* [3.11] gh-115198: Fix test_check_metadata_deprecation in test_distutils

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

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-09 18:23:29 -05:00
Miss Islington (bot) 7542210a95
[3.11] gh-115165: Fix `typing.Annotated` for immutable types (GH-115213) (#115228)
gh-115165: Fix `typing.Annotated` for immutable types (GH-115213)

The return value from an annotated callable can raise any exception from
__setattr__ for the `__orig_class__` property.
(cherry picked from commit 564385612c)

Co-authored-by: dave-shawley <daveshawley@gmail.com>
2024-02-09 22:43:24 +00:00
Miss Islington (bot) 20c6535693
[3.11] gh-115059: Flush the underlying write buffer in io.BufferedRandom.read1() (GH-115163) (GH-115206)
(cherry picked from commit 846fd721d5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-09 11:01:47 +00:00
Miss Islington (bot) 5fc2f5571d
gh-115167: Exclude vcruntime140_threads.dll from Windows build output (GH-115176)
(cherry picked from commit 5914a211ef)

Co-authored-by: adang1345 <adang1345@gmail.com>
2024-02-08 22:19:11 +00:00
Pablo Galindo 6bc531610f Merge remote-tracking branch 'upstream/3.11' into 3.11 2024-02-06 23:38:43 +00:00
Erlend E. Aasland 3a23aa77a6
[3.11] gh-115009: Update Windows installer to use SQLite 3.45.1 (#115065) (#115111)
(cherry picked from commit 11ac6f5354)
2024-02-06 23:06:34 +00:00
Pablo Galindo db85d51d3e Python 3.11.8 2024-02-06 21:21:21 +00:00
Miss Islington (bot) a04dc43148
[3.11] GH-gh-75705: Set unixfrom envelope in mailbox._mboxMMDF (GH-107117) (GH-115099)
(cherry picked from commit 76108b8b05)

Co-authored-by: Matthieu Caneill <matthieucan@users.noreply.github.com>
2024-02-06 19:16:54 +00:00
Miss Islington (bot) b5a679304b
[3.11] gh-111239: Update Windows build to use zlib 1.3.1 (GH-114877) (GH-115080)
gh-111239: Update Windows build to use zlib 1.3.1 (GH-114877)
(cherry picked from commit 618d7256e7)

Co-authored-by: Zachary Ware <zach@python.org>
2024-02-06 15:54:05 +01:00
Peter Lazorchak a11312456d
[3.11] gh-89811: Check for valid tp_version_tag in specializer (GH-115045)
* gh-89811: Check for valid tp_version_tag in specializer (GH-113558)

* gh-113937 Fix failures in type cache tests due to re-running (GH-113953)

* Update backported code for 3.11 specifically
2024-02-06 21:58:30 +08:00
Erlend E. Aasland 2e99ba9e90
[3.11] gh-115009: Update macOS installer to use SQLite 3.45.1 (#115066) (#115072)
(cherry picked from commit 13eb5215c9)

Co-authored-by: Ned Deily <nad@python.org>
2024-02-06 10:25:54 +00:00
Erlend E. Aasland ead9e784fb
[3.11] gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016) (#115069)
(cherry picked from commit 09096a1647)
2024-02-06 11:21:00 +01:00
Ned Deily 319e69579e
[3.11] gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.13. (GH-115057)
Also update multissltests to use 1.1.1w, 3.0.13, 3.1.5, and 3.2.1.
2024-02-05 23:02:10 -05:00
Miss Islington (bot) 753d0d559c
[3.11] gh-109991: Update macOS installer to use OpenSSL 3.0.13. (GH-115054)
(cherry picked from commit 638e811a3c)

Co-authored-by: Ned Deily <nad@python.org>
2024-02-06 02:16:32 +00:00
Zachary Ware 30d999fa50
[3.11] gh-109991: Update Windows build to use OpenSSL 3.0.13 (#115048)
(cherry picked from commit 01dceba13e)
2024-02-06 00:19:44 +00:00
Serhiy Storchaka e1976399cd
[3.11] gh-109475: Fix support of explicit option value "--" in argparse (GH-114814) (GH-115037)
For example "--option=--".
(cherry picked from commit 4aa4f0906d)
2024-02-05 21:04:11 +00:00
Travis Howse 5ce076fd92
[3.11] gh-114887 Reject only sockets of type SOCK_STREAM in create_da… (#114979)
Also improve exception message.

(cherry picked from commit 94ec2b9c9c)

Co-authored-by: Donghee Na <donghee.na92@gmail.com>
2024-02-04 20:01:37 -08:00
Serhiy Storchaka 0244e96d10
[3.11] gh-114388: Fix warnings when assign an unsigned integer member (GH-114391) (GH-115002)
* Fix a RuntimeWarning emitted when assign an integer-like value that
  is not an instance of int to an attribute that corresponds to a C
  struct member of type T_UINT and T_ULONG.
* Fix a double RuntimeWarning emitted when assign a negative integer value
  to an attribute that corresponds to a C struct member of type T_UINT.
(cherry picked from commit 3ddc515255)
2024-02-04 17:54:26 +00:00
Miss Islington (bot) f18341fa4e
[3.11] gh-113951: Tkinter: "tag_unbind(tag, sequence, funcid)" now only unbinds "funcid" (GH-113955) (GH-114998)
Previously, "tag_unbind(tag, sequence, funcid)" methods of Text and
Canvas widgets destroyed the current binding for "sequence", leaving
"sequence" unbound, and deleted the "funcid" command.

Now they remove only "funcid" from the binding for "sequence", keeping
other commands, and delete the "funcid" command.
They leave "sequence" unbound only if "funcid" was the last bound command.
(cherry picked from commit 7e42fddf60)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-04 16:47:03 +00:00
Miss Islington (bot) f8cba751e2
[3.11] gh-113280: Always close socket if SSLSocket creation failed (GH-114659) (GH-114996)
(cherry picked from commit 0ea366240b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-02-04 16:16:57 +00:00