Commit graph

112468 commits

Author SHA1 Message Date
Serhiy Storchaka
fdc9d214c0
[3.10] gh-135462: Fix quadratic complexity in processing special input in HTMLParser (GH-135464) (GH-135485)
Some checks failed
Tests / Check for source changes (push) Has been cancelled
Tests / Ubuntu (push) Has been cancelled
Tests / Check if the ABI has changed (push) Has been cancelled
Tests / Check if generated files are up to date (push) Has been cancelled
Tests / Windows (x86) (push) Has been cancelled
Tests / Windows (x64) (push) Has been cancelled
Tests / macOS (push) Has been cancelled
Tests / Ubuntu SSL tests with OpenSSL (push) Has been cancelled
End-of-file errors are now handled according to the HTML5 specs --
comments and declarations are automatically closed, tags are ignored.
(cherry picked from commit 6eb6c5dbfb)
2025-07-03 23:05:53 +02:00
Łukasz Langa
f297a2292c
[3.10] gh-135374: Update the bundled copy of setuptools to 79.0.1 (#135398)
Some checks failed
Tests / Check for source changes (push) Has been cancelled
Verify bundled pip and setuptools / verify (push) Has been cancelled
Tests / Windows (x86) (push) Has been cancelled
Tests / Check if the ABI has changed (push) Has been cancelled
Tests / Check if generated files are up to date (push) Has been cancelled
Tests / Windows (x64) (push) Has been cancelled
Tests / macOS (push) Has been cancelled
Tests / Ubuntu (push) Has been cancelled
Tests / Ubuntu SSL tests with OpenSSL (push) Has been cancelled
2025-06-11 18:10:27 +02:00
Pablo Galindo
3358f9abf4
Post 3.10.18 2025-06-03 20:02:06 +01:00
Pablo Galindo
88663ef89b
Python 3.10.18 2025-06-03 19:23:41 +01:00
T. Wouters
9c1110ef66
[3.10] gh-135034: Normalize link targets in tarfile, add os.path.realpath(strict='allow_missing') (GH-135037) (#135070)
Addresses CVEs 2024-12718, 2025-4138, 2025-4330, and 2025-4517.
(cherry picked from commit 3612d8f517)
(cherry picked from commit c358142cab)
(cherry picked from commit 371b4eaadc)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Signed-off-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-03 19:02:29 +02:00
Miss Islington (bot)
c71ea4ba06
[3.10] gh-128840: Fix parsing long IPv6 addresses with embedded IPv4 address (GH-134836) (GH-135089)
(cherry picked from commit d83576bf48)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-03 16:21:25 +02:00
Miss Islington (bot)
0a1f75d95d
[3.10] gh-123409: fix IPv6Address.reverse_pointer for IPv4-mapped addresses (GH-123419) (GH-135088)
Fix functionality that was broken with better textual representation for IPv4-mapped addresses (gh-87799)
(cherry picked from commit 77a2fb4bf1)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-06-03 16:01:08 +02:00
Miss Islington (bot)
c0e2658525
[3.10] gh-128840: Limit the number of parts in IPv6 address parsing (GH-128841) (GH-134614)
Limit length of IP address string to 39

(cherry picked from commit 47f1161d3a)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-06-03 15:55:27 +02:00
Miss Islington (bot)
24bd1834ca
[3.10] gh-87799: Improve the textual representation of IPv4-mapped IPv6 addresses (GH-29345) (GH-135079)
Represent IPv4-mapped IPv6 address as xxxd.d.d.d,
where the 'x's are the hexadecimal values
of the six high-order 16-bit pieces of the address,
and the 'd's are the decimal values
of the four low-order 8-bit pieces of the address
(standard IPv4 representation).

(cherry picked from commit f22bf8e3cf)

Co-authored-by: opavliuk <40970635+opavlyuk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2025-06-03 15:49:38 +02:00
Thomas Wouters
e0cb9afea4 Revert "Fix a glaring error in the logic backport of posixpath."
This reverts commit b357f2bca3, which was
never meant to go into 3.10.
2025-06-03 14:25:37 +02:00
Thomas Wouters
b357f2bca3 Fix a glaring error in the logic backport of posixpath. 2025-06-03 14:12:21 +02:00
Miss Islington (bot)
880adf6c31
[3.10] gh-134062: Fix hash collisions in IPv4Network and IPv6Network (GH-134063) (GH-134480)
(cherry picked from commit f3fc0c16e0)

Co-authored-by: Mike Salvatore <mike.s.salvatore@gmail.com>
2025-06-02 17:56:01 +02:00
Serhiy Storchaka
ab9893c406
[3.10] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944) (GH-134345)
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().

_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623)
(cherry picked from commit 6279eb8c07)
(cherry picked from commit a75953b347)
(cherry picked from commit 0c33e5baed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 17:55:48 +02:00
Miss Islington (bot)
f85e71a008
[3.10] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503) (GH-126572) (#134030)
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.

(cherry picked from commit c9cda1608e)
(cherry picked from commit aee80cd5e7)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-01 15:30:13 +02:00
Pablo Galindo
6322edd260
Post 3.10.17 2025-04-08 14:27:31 +01:00
Pablo Galindo
26ee8cad13
Python 3.10.17 2025-04-08 13:10:59 +01:00
Seth Michael Larson
53d4eaada7
[3.10] gh-131809: Upgrade vendored expat to 2.7.1 (GH-132192) (#132241)
(cherry picked from commit c0de650024)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-04-08 11:36:48 +02:00
R. David Murray
a4ef689ce6
[3.10] gh-80222: Fix email address header folding with long quoted-string (GH-122753) (GH-129111)
Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416858)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-04-03 18:58:22 +02:00
Petr Viktorin
cfaee20d7e
[3.10] gh-121284: Fix email address header folding with parsed encoded-word (GH-122754) (GH-131411)
Email generators using email.policy.default may convert an RFC 2047
encoded-word to unencoded form during header refolding. In a structured
header, this could allow 'specials' chars outside a quoted-string,
leading to invalid address headers and enabling spoofing. This change
ensures a parsed encoded-word that contains specials is kept as an
encoded-word while the header is refolded.

[Better fix from @bitdancer.]

(cherry picked from commit 295b53df2a)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: R David Murray <rdmurray@bitdance.com>
2025-04-03 18:27:20 +02:00
Victor Stinner
48f455e11d
[3.10] gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361) (GH-127905) (GH-131971)
gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361)

From the ERR_raise manpage:

    ERR_LIB_SYS

        This "library code" indicates that a system error is
        being reported.  In this case, the reason code given
        to `ERR_raise()` and `ERR_raise_data()` *must* be
        `errno(3)`.

This PR only handles ERR_LIB_SYS for the high-lever error types
SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where
OpenSSL indicates it has some more information about the issue.

(cherry picked from commit f4b31edf2d)
(cherry picked from commit 7f707fa6c6)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-04-03 18:26:17 +02:00
Seth Michael Larson
b22e6076d2
[3.10] gh-131261: Update libexpat to 2.7.0 (CVE-2024-8176) (GH-131272) (#131363) 2025-04-01 10:40:26 +01:00
Miss Islington (bot)
b8b4b713c5
[3.10] gh-105704: Disallow square brackets ([ and ]) in domain names for parsed URLs (GH-129418) (#129529)
(cherry picked from commit d89a5f6a6e)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-02-19 14:36:23 +01:00
Miss Islington (bot)
817564849e
[3.10] gh-119511: Fix a potential denial of service in imaplib (GH-119514) (#129358)
The IMAP4 client could consume an arbitrary amount of memory when trying
to connect to a malicious server, because it read a "literal" data with a
single read(size) call, and BufferedReader.read() allocates the bytes
object of the specified size before reading. Now the IMAP4 client reads data
by chunks, therefore the amount of used memory is limited by the
amount of the data actually been sent by the server.
(cherry picked from commit 735f25c5e3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-02-19 14:30:32 +01:00
Hugo van Kemenade
457b2cac73
[3.10] gh-122544: Change OS image in GitHub Actions to Ubuntu 22.04 (GH-122566) (#130268)
Co-authored-by: Damien <81557462+Damien-Chen@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: James De Bias <81095953+DBJim@users.noreply.github.com>
2025-02-19 14:19:52 +01:00
Miss Islington (bot)
4413f2e3f1
[3.10] gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322) (#130274)
Co-authored-by: James De Bias <81095953+DBJim@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-19 10:52:03 +02:00
Petr Viktorin
d09105c0df
[3.10] gh-129509: Add required key to the dummy Read the Docs config file (#129510) 2025-02-18 10:42:42 +02:00
Adam Turner
1d4db86b4d
[3.10] Docs: pin python-docs-theme to 2025.2 (GH-129576) (#130067)
[3.10] [3.11] Docs: pin python-docs-theme to 2025.2 (GH-129576)

* [3.11] Pin python-docs-theme

* Use today's release



---------
(cherry picked from commit 77ca2f66ea)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-13 01:39:02 +00:00
Petr Viktorin
7b0351cf6a
[3.10] gh-129641: Docs GHA build: use upload-artifact@v4 & Python 3.12 (#129642)
* [3.10] gh-129641: Switch Docs GHA build to actions/upload-artifact@v4

Add options for backwards compatibility, from the docs at:
https://github.com/actions/upload-artifact?tab=readme-ov-file#breaking-changes

* Python Tutorial typo fix (#128077)

Backported form commit: 5a584c8f54

This is a trivial change meant to trigger a Docs build.

* Use Python 3.12 for the 3.10 docs build

The pinned version of Sphinx requires `imghdr`, removed in Python 3.13.

---------

Co-authored-by: shallow-beach <96891913+shallow-beach@users.noreply.github.com>
2025-02-13 01:31:51 +00:00
Miss Islington (bot)
2bd9f9b054
[3.10] gh-119461: Fix ThreadedVSOCKSocketStreamTest (GH-129171) (#129440)
* [3.11] gh-119461: Fix ThreadedVSOCKSocketStreamTest (GH-129171)

Fix ThreadedVSOCKSocketStreamTest: if get_cid() returns the host
address or the "any" address, use the local communication address
(loopback): VMADDR_CID_LOCAL.

On Linux 6.9, apparently, the /dev/vsock device is now available but
get_cid() returns VMADDR_CID_ANY (-1).

(cherry picked from commit 45db419c31)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit e94dbe4ed8)
(cherry picked from commit c750061047)
(cherry picked from commit cbfe3023e4)

* gh-119461: Restore the testSocket VSOCK skipUnless removed by PR #119465 (#129561)

Restore the skipUnless removed by #119465.

This test can only pass on virtual machines, not actual machines.

actual machines see:

```
    self.cli.connect((cid, VSOCKPORT))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
OSError: [Errno 19] No such device
```

Reproduced on (Linux) Ubuntu 24.04.1 running 6.8.0-52-generic.

---------

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-02-13 01:31:13 +00:00
Victor Stinner
10a2a9b3bc
[3.10] gh-128874: Fix the documentation for blurb 2.0 (#128875) (#128890)
gh-128874: Fix the documentation for blurb 2.0 (#128875)

(cherry picked from commit 40a4d88a14)
2025-01-21 19:26:21 +00:00
Petr Viktorin
8773554b71
[3.10] gh-121277: Allow .. versionadded:: next in docs (GH-121278) (#127867)
Make `versionchanged:: next`` expand to current (unreleased) version.

When a new CPython release is cut, the release manager will replace
all such occurences of "next" with the just-released version.
(See the issue for release-tools and devguide PRs.)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
(cherry picked from commit 7d24ea9db3)

gh-121277: Raise nice error on `next` as second argument to deprecated-removed (GH-124623)

(cherry-picked from e349f73a5a)

Updates for 3.10

(cherry-picked from 3.11: f0895aa9c1)

* Use version, not arguments directly
2024-12-13 22:00:34 +00:00
Pablo Galindo
362fc98c03 Post 3.10.16 2024-12-03 13:35:58 -05:00
Pablo Galindo
890778604a Python 3.10.16 2024-12-03 12:27:57 -05:00
Miss Islington (bot)
b58da409aa
[3.10] gh-122792: Make IPv4-mapped IPv6 address properties consistent with IPv4 (GH-122793) (GH-123819)
Make IPv4-mapped IPv6 address properties consistent with IPv4.
(cherry picked from commit 76a1c5d183)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-12-03 18:07:43 +01:00
Seth Michael Larson
b3a6042361
[3.10] gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792) (GH-126799)
(cherry picked from commit 3c99969094)
2024-12-02 16:07:06 +01:00
Victor Stinner
634ded4554
[3.10] gh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format (#103849) (#126975)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
(cherry picked from commit 29f348e232)

Co-authored-by: JohnJamesUtley <81572567+JohnJamesUtley@users.noreply.github.com>
2024-12-02 13:37:05 +01:00
Hugo van Kemenade
e43897c340
[3.10] gh-127359: Pin Tcl/Tk to 8 (8.6) for testing macOS (GH-127365) (#127408) 2024-11-30 18:38:29 +02:00
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