0
0
mirror of https://github.com/python/cpython.git synced 2024-11-24 00:38:00 +01:00
Commit Graph

112431 Commits

Author SHA1 Message Date
Petr Viktorin
5f24da9d75
[3.10] gh-113027: Fix test_variable_tzname in test_email (GH-113821) (#126438) 2024-11-05 19:55:43 +00:00
Victor Stinner
9286ab3a10
[3.10] gh-124651: Quote template strings in venv activation scripts (GH-124712) (GH-126185) (GH-126269) (GH-126300)
(cherry picked from commit ae961ae94b)
2024-11-04 16:16:17 +01:00
Petr Viktorin
6a2f12a754
[3.10] gh-125529: Avoid f-strings in the metagrammar (#125582)
Grammar actions need to be valid Python tokens and the accepted tokens need to be
listed in the actions mini-grammar).

In Python 3.12+ (PEP 701), f-strings are no longer STRING tokens, so pegen fails
to regenerate the metaparser on this Python version, as in:

   PYTHON_FOR_REGEN=python3.12 make regen-pegen-metaparser

Use `+` and plain strings rather than f-strings.

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-10-22 12:41:51 +01:00
Petr Viktorin
3c63d80b95
[3.10] gh-125041: gh-90781: test_zlib: For s390x HW acceleration, skip checking the compressed bytes (GH-125042) (#125585)
gh-125041: gh-90781: test_zlib: For s390x HW acceleration, skip checking the compressed bytes (GH-125042)

This backports two commits:

- GH-31096 skipped the tests unconditionally
- GH-125042 skips only the possibly-failing assertion

(cherry picked from commit cc5a225cdc)
2024-10-22 12:11:21 +01:00
Petr Viktorin
6bbaab801b
[3.10] gh-107902: gh-108948: Don't test setting suid/sgid/sticky on systems that don't support them (GH-108368) (GH-109697) (#125255)
* gh-107902: Don't test setting suid/sgid on systems that don't support them (GH-108368)

* gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

---------

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-22 12:11:11 +01:00
Miss Islington (bot)
b116237592
[3.10] gh-100005: Skip test_script_as_dev_fd() on FreeBSD (GH-100006) (#125109)
gh-100005: Skip test_script_as_dev_fd() on FreeBSD (GH-100006)

On FreeBSD, skip test_script_as_dev_fd() of test_cmd_line_script if
fdescfs is not mounted (at /dev/fd).
(cherry picked from commit 038b151963)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-22 12:11:04 +01:00
Miss Islington (bot)
e44b32f1c9
[3.10] gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423) (#125106)
[3.11] gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423) (GH-109427)

gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423)

Use a longer key: FIPS mode requires at least of at least 112 bits.
The previous key was only 32 bits.
(cherry picked from commit e091b9f20f)

(cherry picked from commit f7bfac4b3d)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-22 12:10:53 +01:00
Petr Viktorin
850189a64e
[3.10] gh-89452: GHA: Set --with-dbmliborder to avoid issues with homebrew's gdbm 1.24 (#125112)
Per https://github.com/python/cpython/issues/89452#issuecomment-1116329316,
the issue is fixed in configure for 3.11+, and

> For older Python versions, the workaround is to build with:
>
>     ./configure --with-dbmliborder=gdbm:ndbm

We need this workaround in GitHub Actions, otherwise the tests fail.
2024-10-08 16:37:22 +02:00
Pablo Galindo
0c5fc27217 Post 3.10.15 2024-09-07 01:46:51 +01:00
Pablo Galindo
ffee63f344 Python 3.10.15 2024-09-07 01:20:06 +01:00
Petr Viktorin
2a9273a0e4
[3.10] [CVE-2023-27043] gh-102988: Reject malformed addresses in email.parseaddr() (GH-111116) (#123768)
Detect email address parsing errors and return empty tuple to
indicate the parsing error (old API). Add an optional 'strict'
parameter to getaddresses() and parseaddr() functions. Patch by
Thomas Dwyer.

(cherry picked from commit 4a153a1d3b)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-Authored-By: Thomas Dwyer <github@tomd.tel>
2024-09-06 13:14:22 +02:00
Seth Michael Larson
0e006ce344
[3.10] gh-123678: Upgrade libexpat 2.6.3 (#123710)
(cherry picked from commit fdc04ad75a)
2024-09-05 14:27:33 +02:00
Jason R. Coombs
4633177a08
[3.10] gh-123693: Use platform-agnostic semantics when processing zipfile.Path.name. (#123694)
Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-09-05 11:15:03 +02:00
Jason R. Coombs
0aa1ee22ab
[3.10] gh-123270: Replaced SanitizedNames with a more surgical fix. (GH-123354) (#123426)
Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-09-04 22:41:39 +02:00
Miss Islington (bot)
d3f39cefe7
[3.10] gh-112275: Fix HEAD_LOCK deadlock in child process after fork (GH-112336) (#123687)
HEAD_LOCK is called from _PyEval_ReInitThreads->_PyThreadState_DeleteExcept before _PyRuntimeState_ReInitThreads reinit runtime->interpreters.mutex which might be locked before fork.

(cherry picked from commit 522799a05e)

Co-authored-by: ChuBoning <102216855+ChuBoning@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-09-04 19:26:29 +02:00
Steve Dower
2e861ac1cd
[3.10] gh-119690: Fixes buffer type confusion in _winapi.CreateFile and _winapi.CreateNamedPipe audit events (#119735)
gh-119690: Fixes buffer type confusion in _winapi.CreateFile and _winapi.CreateNamedPipe audit events
2024-09-04 17:57:40 +02:00
Miss Islington (bot)
b2f11ca766
[3.10] gh-123067: Fix quadratic complexity in parsing "-quoted cookie values with backslashes (GH-123075) (#123106)
This fixes CVE-2024-7592.
(cherry picked from commit 44e458357f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-04 17:50:36 +02:00
Serhiy Storchaka
2fa5d70684
[3.10] gh-67693: Fix urlunparse() and urlunsplit() for URIs with path starting with multiple slashes and no authority (GH-113563) (#119026)
(cherry picked from commit e237b25a4f)
2024-09-04 17:43:30 +02:00
Łukasz Langa
06f28dc236
[3.10] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122609)
Per RFC 2047:

> [...] these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects

It seems that the "quoted-word" scheme is a valid way to include
a newline character in a header value, just like we already allow
undecodable bytes or control characters.
They do need to be properly quoted when serialized to text, though.

This should fail for custom fold() implementations that aren't careful
about newlines.

(cherry picked from commit 0976339818)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Bas Bloemsaat <bas@bloemsaat.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-04 17:38:31 +02:00
Seth Michael Larson
743acbe872
[3.10] gh-121285: Remove backtracking when parsing tarfile headers (GH-121286) (#123640)
* Remove backtracking when parsing tarfile headers
* Rewrite PAX header parsing to be stricter
* Optimize parsing of GNU extended sparse headers v0.0

(cherry picked from commit 34ddb64d08)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-09-03 15:07:53 +00:00
Jason R. Coombs
e0264a6111
[3.10] gh-122905: Sanitize names in zipfile.Path. (GH-122906) (#123160)
[3.10] [3.11] gh-122905: Sanitize names in zipfile.Path. (GH-122906) (GH-122925)

* gh-122905: Sanitize names in zipfile.Path. (GH-122906)

Ported from zipp 3.19.1; ref jaraco/zippGH-119.

(cherry picked from commit 9cd0326310)

* [3.11] gh-122905: Sanitize names in zipfile.Path. (GH-122906)

Ported from zipp 3.19.1; ref jaraco/zippGH-119.
(cherry picked from commit 9cd0326310)

(cherry picked from commit 795f2597a4)
2024-08-23 00:24:33 +01:00
Miss Islington (bot)
31302f5fc2
[3.10] gh-122133: Rework pure Python socketpair tests to avoid use of importlib.reload. (GH-122493) (GH-122507)
(cherry picked from commit f071f01b7b)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-08-02 15:10:39 +02:00
Miss Islington (bot)
0b65c8bf53
[3.10] gh-122133: Authenticate socket connection for socket.socketpair() fallback (GH-122134) (#122427)
Authenticate socket connection for `socket.socketpair()` fallback when the platform does not have a native `socketpair` C API.  We authenticate in-process using `getsocketname` and `getpeername` (thanks to Nathaniel J Smith for that suggestion).

(cherry picked from commit 78df1043db)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-30 14:44:16 +02:00
Łukasz Langa
d86ab5dde2
[3.10] gh-121957: Emit audit events for python -i and python -m asyncio (GH-122119) 2024-07-22 13:48:50 +02:00
Ned Deily
48f9d3e3fa
[3.10] gh-112769: test_zlib: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771) (#119565)
[3.10] gh-112769: test_zlib: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok miro@hroncok.cz
2024-05-28 16:57:05 +01:00
Steve Dower
c8f868dc52
[3.10] gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) (GH-118740)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-24 19:26:44 +02:00
Dimitri John Ledkov
333c7dccd8
[3.10] gh-100454: Fix running SSL tests with OpenSSL 3.1+ (GH-100456) (GH-118262)
This fixes Ubuntu pipeline with OpenSSL 3.1+

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2024-05-07 12:00:40 +02:00
Petr Viktorin
c62c9e518b
[3.10] gh-113171: gh-65056: Fix "private" (non-global) IP address ranges (GH-113179) (GH-113186) (GH-118177) (GH-118229)
The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] https://github.com/python/cpython/issues/61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2024-05-07 11:56:13 +02:00
Seth Michael Larson
2ec7018191
[3.10] gh-116741: Upgrade libexpat to 2.6.2 (GH-117296) (GH-118186)
(cherry picked from commit c9829eec08)
2024-05-07 10:50:19 +02:00
Miss Islington (bot)
9b33629f96
[3.10] gh-114539: Clarify implicit launching of shells by subprocess (GH-117996) (GH-118004)
(cherry picked from commit a4b44d39cd)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-07 10:47:46 +02:00
jkriegshauser
812245ecce
[3.10] gh-116773: Fix overlapped memory corruption crash (GH-116774) (GH-117079)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-03-27 16:24:34 +01:00
Miss Islington (bot)
0a263ccd1f
[3.10] gh-117187: Fix XML tests for vanilla Expat <2.6.0 (GH-117203) (GH-117246)
This fixes XML unittest fallout from the https://github.com/python/cpython/issues/115398 security fix.  When configured using `--with-system-expat` on systems with older pre 2.6.0 versions of libexpat, our unittests were failing.

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2024-03-27 14:44:58 +01:00
Łukasz Langa
83518b3511
Post 3.10.14 2024-03-20 00:40:17 +01:00
Łukasz Langa
976ea78599
Python 3.10.14 2024-03-19 22:46:16 +01:00
Miss Islington (bot)
eac14953a0
[3.10] gh-115197: Stop resolving host in urllib.request proxy bypass (GH-115210) (GH-116070)
Use of a proxy is intended to defer DNS for the hosts to the proxy itself, rather than a potential for information leak of the host doing DNS resolution itself for any reason.  Proxy bypass lists are strictly name based.  Most implementations of proxy support agree.
(cherry picked from commit c43b26d02e)

Co-authored-by: Weii Wang <weii.wang@canonical.com>
2024-03-19 11:53:33 +01:00
Sebastian Pipping
516a6d4237
[3.10] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623) (GH-116270)
Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:

- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`

Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 .

Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-03-07 00:02:55 +01:00
Miss Islington (bot)
b612ec6b19
[3.10] gh-115399: Document CVE-2023-52425 under "XML vulnerabilities" (GH-115400) (GH-115762)
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:27 +01:00
Miss Islington (bot)
37324b421b
[3.10] gh-114572: Fix locking in cert_store_stats and get_ca_certs (GH-114573) (#115548)
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:35:27 +00:00
Miss Islington (bot)
d0524caed0
[3.10] Upgrade bundled libexpat to 2.6.0 (GH-115399) (GH-115468) (#115473)
Manual backport due to code differences.
(cherry picked from commit e071b0d558)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-02-19 14:58:39 +00:00
Ned Deily
17a6533dbf
[3.10] gh-97032: avoid test_squeezer crash on macOS buildbots (#115508)
avoid test_squeezer crash on macOS buildbots
2024-02-19 13:43:38 +00:00
Miss Islington (bot)
d9c79e1364
[3.10] gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164) (#115525)
gh-115133: Fix tests for XMLPullParser with Expat 2.6.0 (GH-115164)

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-19 13:38:49 +00:00
Miss Islington (bot)
6091fbda8b
[3.10] gh-105821: Use a raw f-string in test_httpservers.py (GH-105822) (#115519) 2024-02-16 01:06:00 +00:00
Miss Islington (bot)
0e7ff84038
[3.10] Add missing sections to blurbs (GH-114553) (#115338) 2024-02-14 13:23:26 +00:00
Łukasz Langa
c3108e1214
[3.10] gh-46968: Fix invalid reference to Sound eXchange (SoX) 12.17.7 license (GH-115094) (GH-115096)
(cherry picked from commit b39119916c)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-02-06 19:53:23 +01:00
Miss Islington (bot)
806e6ecb2f
[3.10] gh-111239: Update Windows build to use zlib 1.3.1 (GH-114877) (#115079)
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:40:18 +01:00
Miss Islington (bot)
9afc6d102d
[3.10] gh-113659: Skip hidden .pth files (GH-113660) (GH-114145)
Skip .pth files with names starting with a dot or hidden file attribute.
(cherry picked from commit 74208ed0c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-01-18 14:39:30 +01:00
Miss Islington (bot)
1274896727
[3.10] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (GH-114185)
(cherry picked from commit 9dbfe2dc8e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-01-17 15:02:42 +01:00
Adam Turner
6661b228ba
[3.10] gh-114021: Pin various sphinxcontrib extensions to older versions (GH-114022) (GH-114038)
(cherry picked from commit 94b1d1fa38)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2024-01-17 14:50:24 +01:00
Miss Islington (bot)
30fe5d853b
[3.10] gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016) (GH-113914)
Raise BadZipFile when try to read an entry that overlaps with other entry or
central directory.
(cherry picked from commit 66363b9a7b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-17 14:50:10 +01:00
Serhiy Storchaka
8eaeefe49d
[3.10] gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930) (GH-112840)
(cherry picked from commit 81c16cd94e)

Co-authored-by: Søren Løvborg <sorenl@unity3d.com>
2024-01-17 14:49:56 +01:00