forked from python-interpreters/python314
Compare commits
23 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
a667dcdda9
|
|||
|
2ac99260ce
|
|||
|
3198f34561
|
|||
|
ae199523cc
|
|||
|
5a93ef3ac0
|
|||
|
3a530bad02
|
|||
|
706c7b4cac
|
|||
|
f41d0d940b
|
|||
|
c99dacd908
|
|||
|
3206c36a35
|
|||
|
16a4b703f5
|
|||
|
597c86f858
|
|||
|
8e0da3e0be
|
|||
|
efcb67a2f8
|
|||
|
cc505ee89f
|
|||
|
902b37d5bd
|
|||
|
3a0658eda4
|
|||
|
faa9dd3a19
|
|||
|
70db7ff339
|
|||
|
|
5a4398f438
|
||
|
7cd0446b54
|
|||
|
08540e4dfe
|
|||
|
7a848baf56
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,5 @@
|
||||
*.obscpio
|
||||
_build.*
|
||||
.pbuild
|
||||
*.orig
|
||||
python314-*-build/
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
Lib/test/test_xml_etree.py | 10 ++++++++++
|
||||
3 files changed, 17 insertions(+)
|
||||
|
||||
Index: Python-3.14.0/Lib/test/test_pyexpat.py
|
||||
Index: Python-3.14.2/Lib/test/test_pyexpat.py
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Lib/test/test_pyexpat.py 2025-10-08 11:27:29.989583305 +0200
|
||||
+++ Python-3.14.0/Lib/test/test_pyexpat.py 2025-10-08 11:28:09.418914658 +0200
|
||||
@@ -827,6 +827,10 @@
|
||||
--- Python-3.14.2.orig/Lib/test/test_pyexpat.py 2025-12-11 18:10:58.057084164 +0100
|
||||
+++ Python-3.14.2/Lib/test/test_pyexpat.py 2025-12-11 18:12:07.480767746 +0100
|
||||
@@ -848,6 +848,10 @@
|
||||
self.assertEqual(started, ['doc'])
|
||||
|
||||
def test_reparse_deferral_disabled(self):
|
||||
@@ -19,10 +19,10 @@ Index: Python-3.14.0/Lib/test/test_pyexpat.py
|
||||
started = []
|
||||
|
||||
def start_element(name, _):
|
||||
Index: Python-3.14.0/Lib/test/test_sax.py
|
||||
Index: Python-3.14.2/Lib/test/test_sax.py
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Lib/test/test_sax.py 2025-10-08 11:27:30.053760879 +0200
|
||||
+++ Python-3.14.0/Lib/test/test_sax.py 2025-10-08 11:28:09.419532320 +0200
|
||||
--- Python-3.14.2.orig/Lib/test/test_sax.py 2025-12-11 18:10:58.116419305 +0100
|
||||
+++ Python-3.14.2/Lib/test/test_sax.py 2025-12-11 18:12:07.481506046 +0100
|
||||
@@ -1241,6 +1241,9 @@
|
||||
|
||||
self.assertEqual(result.getvalue(), start + b"<doc></doc>")
|
||||
@@ -33,10 +33,10 @@ Index: Python-3.14.0/Lib/test/test_sax.py
|
||||
def test_flush_reparse_deferral_disabled(self):
|
||||
result = BytesIO()
|
||||
xmlgen = XMLGenerator(result)
|
||||
Index: Python-3.14.0/Lib/test/test_xml_etree.py
|
||||
Index: Python-3.14.2/Lib/test/test_xml_etree.py
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Lib/test/test_xml_etree.py 2025-10-08 11:27:30.502943506 +0200
|
||||
+++ Python-3.14.0/Lib/test/test_xml_etree.py 2025-10-08 11:28:09.420206077 +0200
|
||||
--- Python-3.14.2.orig/Lib/test/test_xml_etree.py 2025-12-11 18:10:58.548740381 +0100
|
||||
+++ Python-3.14.2/Lib/test/test_xml_etree.py 2025-12-11 18:12:07.481767744 +0100
|
||||
@@ -138,6 +138,11 @@
|
||||
return mock.patch.object(cls, "__eq__", autospec=True, wraps=eq)
|
||||
|
||||
@@ -49,7 +49,7 @@ Index: Python-3.14.0/Lib/test/test_xml_etree.py
|
||||
def checkwarnings(*filters, quiet=False):
|
||||
def decorator(test):
|
||||
def newtest(*args, **kwargs):
|
||||
@@ -1547,9 +1552,11 @@
|
||||
@@ -1573,9 +1578,11 @@
|
||||
self.assert_event_tags(parser, [('end', 'root')])
|
||||
self.assertIsNone(parser.close())
|
||||
|
||||
@@ -61,7 +61,7 @@ Index: Python-3.14.0/Lib/test/test_xml_etree.py
|
||||
def test_simple_xml_chunk_5(self):
|
||||
self.test_simple_xml(chunk_size=5, flush=True)
|
||||
|
||||
@@ -1774,6 +1781,9 @@
|
||||
@@ -1802,6 +1809,9 @@
|
||||
|
||||
self.assert_event_tags(parser, [('end', 'doc')])
|
||||
|
||||
|
||||
41
CVE-2024-6923-follow-up-EOL-email-headers.patch
Normal file
41
CVE-2024-6923-follow-up-EOL-email-headers.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From 5a8bfd878f086e28f0849bbc3970ad92f6ba37dc Mon Sep 17 00:00:00 2001
|
||||
From: Seth Michael Larson <seth@python.org>
|
||||
Date: Fri, 23 Jan 2026 08:59:35 -0600
|
||||
Subject: [PATCH] gh-144125: email: verify headers are sound in BytesGenerator
|
||||
(cherry picked from commit 052e55e7d44718fe46cbba0ca995cb8fcc359413)
|
||||
|
||||
Co-authored-by: Seth Michael Larson <seth@python.org>
|
||||
Co-authored-by: Denis Ledoux <dle@odoo.com>
|
||||
Co-authored-by: Denis Ledoux <5822488+beledouxdenis@users.noreply.github.com>
|
||||
Co-authored-by: Petr Viktorin <302922+encukou@users.noreply.github.com>
|
||||
Co-authored-by: Bas Bloemsaat <1586868+basbloemsaat@users.noreply.github.com>
|
||||
---
|
||||
Lib/test/test_email/test_policy.py | 4 ++++
|
||||
Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst | 4 ++++
|
||||
2 files changed, 8 insertions(+)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst
|
||||
|
||||
Index: Python-3.14.3/Lib/test/test_email/test_policy.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/test/test_email/test_policy.py 2026-02-03 16:32:20.000000000 +0100
|
||||
+++ Python-3.14.3/Lib/test/test_email/test_policy.py 2026-02-13 17:09:32.641745760 +0100
|
||||
@@ -323,6 +323,10 @@
|
||||
message.as_bytes(),
|
||||
f"{text}\nBody".encode(),
|
||||
)
|
||||
+ self.assertEqual(
|
||||
+ message.as_bytes(),
|
||||
+ f"{text}\nBody".encode(),
|
||||
+ )
|
||||
|
||||
# XXX: Need subclassing tests.
|
||||
# For adding subclassed objects, make sure the usual rules apply (subclass
|
||||
Index: Python-3.14.3/Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ Python-3.14.3/Misc/NEWS.d/next/Security/2026-01-21-12-34-05.gh-issue-144125.TAz5uo.rst 2026-02-13 17:09:32.642152246 +0100
|
||||
@@ -0,0 +1,4 @@
|
||||
+:mod:`~email.generator.BytesGenerator` will now refuse to serialize (write) headers
|
||||
+that are unsafely folded or delimited; see
|
||||
+:attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas
|
||||
+Bloemsaat and Petr Viktorin in :gh:`121650`).
|
||||
196
CVE-2025-12781-b64decode-alt-chars.patch
Normal file
196
CVE-2025-12781-b64decode-alt-chars.patch
Normal file
@@ -0,0 +1,196 @@
|
||||
From f922c02c529d25d61aa9c28a8192639c1fce8d4d Mon Sep 17 00:00:00 2001
|
||||
From: Serhiy Storchaka <storchaka@gmail.com>
|
||||
Date: Wed, 5 Nov 2025 20:12:31 +0200
|
||||
Subject: [PATCH] gh-125346: Add more base64 tests
|
||||
|
||||
Add more tests for the altchars argument of b64decode() and for the map01
|
||||
argument of b32decode().
|
||||
---
|
||||
Doc/library/base64.rst | 18 ++--
|
||||
Lib/base64.py | 40 +++++++-
|
||||
Lib/test/test_base64.py | 45 ++++++++--
|
||||
Misc/NEWS.d/next/Library/2025-11-06-12-03-29.gh-issue-125346.7Gfpgw.rst | 5 +
|
||||
4 files changed, 91 insertions(+), 17 deletions(-)
|
||||
|
||||
Index: Python-3.14.3/Doc/library/base64.rst
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Doc/library/base64.rst 2026-02-03 16:32:20.000000000 +0100
|
||||
+++ Python-3.14.3/Doc/library/base64.rst 2026-02-13 15:43:18.030360439 +0100
|
||||
@@ -77,15 +77,20 @@
|
||||
A :exc:`binascii.Error` exception is raised
|
||||
if *s* is incorrectly padded.
|
||||
|
||||
- If *validate* is ``False`` (the default), characters that are neither
|
||||
+ If *validate* is false (the default), characters that are neither
|
||||
in the normal base-64 alphabet nor the alternative alphabet are
|
||||
- discarded prior to the padding check. If *validate* is ``True``,
|
||||
- these non-alphabet characters in the input result in a
|
||||
- :exc:`binascii.Error`.
|
||||
+ discarded prior to the padding check, but the ``+`` and ``/`` characters
|
||||
+ keep their meaning if they are not in *altchars* (they will be discarded
|
||||
+ in future Python versions).
|
||||
+ If *validate* is true, these non-alphabet characters in the input
|
||||
+ result in a :exc:`binascii.Error`.
|
||||
|
||||
For more information about the strict base64 check, see :func:`binascii.a2b_base64`
|
||||
|
||||
- May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2.
|
||||
+ .. deprecated:: next
|
||||
+ Accepting the ``+`` and ``/`` characters with an alternative alphabet
|
||||
+ is now deprecated.
|
||||
+
|
||||
|
||||
.. function:: standard_b64encode(s)
|
||||
|
||||
@@ -116,6 +121,9 @@
|
||||
``/`` in the standard Base64 alphabet, and return the decoded
|
||||
:class:`bytes`.
|
||||
|
||||
+ .. deprecated:: next
|
||||
+ Accepting the ``+`` and ``/`` characters is now deprecated.
|
||||
+
|
||||
|
||||
.. function:: b32encode(s)
|
||||
|
||||
Index: Python-3.14.3/Lib/base64.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/base64.py 2026-02-13 15:20:33.905228929 +0100
|
||||
+++ Python-3.14.3/Lib/base64.py 2026-02-13 15:43:18.030771327 +0100
|
||||
@@ -69,20 +69,39 @@
|
||||
The result is returned as a bytes object. A binascii.Error is raised if
|
||||
s is incorrectly padded.
|
||||
|
||||
- If validate is False (the default), characters that are neither in the
|
||||
+ If validate is false (the default), characters that are neither in the
|
||||
normal base-64 alphabet nor the alternative alphabet are discarded prior
|
||||
- to the padding check. If validate is True, these non-alphabet characters
|
||||
+ to the padding check. If validate is true, these non-alphabet characters
|
||||
in the input result in a binascii.Error.
|
||||
For more information about the strict base64 check, see:
|
||||
|
||||
https://docs.python.org/3.11/library/binascii.html#binascii.a2b_base64
|
||||
"""
|
||||
s = _bytes_from_decode_data(s)
|
||||
+ badchar = None
|
||||
if altchars is not None:
|
||||
altchars = _bytes_from_decode_data(altchars)
|
||||
- assert len(altchars) == 2, repr(altchars)
|
||||
+ if len(altchars) != 2:
|
||||
+ raise ValueError(f'invalid altchars: {altchars!r}')
|
||||
+ for b in b'+/':
|
||||
+ if b not in altchars and b in s:
|
||||
+ badchar = b
|
||||
+ break
|
||||
s = s.translate(bytes.maketrans(altchars, b'+/'))
|
||||
- return binascii.a2b_base64(s, strict_mode=validate)
|
||||
+ result = binascii.a2b_base64(s, strict_mode=validate)
|
||||
+ if badchar is not None:
|
||||
+ import warnings
|
||||
+ if validate:
|
||||
+ warnings.warn(f'invalid character {chr(badchar)!a} in Base64 data '
|
||||
+ f'with altchars={altchars!r} and validate=True '
|
||||
+ f'will be an error in future Python versions',
|
||||
+ DeprecationWarning, stacklevel=2)
|
||||
+ else:
|
||||
+ warnings.warn(f'invalid character {chr(badchar)!a} in Base64 data '
|
||||
+ f'with altchars={altchars!r} and validate=False '
|
||||
+ f'will be discarded in future Python versions',
|
||||
+ FutureWarning, stacklevel=2)
|
||||
+ return result
|
||||
|
||||
|
||||
def standard_b64encode(s):
|
||||
@@ -127,8 +146,19 @@
|
||||
The alphabet uses '-' instead of '+' and '_' instead of '/'.
|
||||
"""
|
||||
s = _bytes_from_decode_data(s)
|
||||
+ badchar = None
|
||||
+ for b in b'+/':
|
||||
+ if b in s:
|
||||
+ badchar = b
|
||||
+ break
|
||||
s = s.translate(_urlsafe_decode_translation)
|
||||
- return b64decode(s)
|
||||
+ result = binascii.a2b_base64(s, strict_mode=False)
|
||||
+ if badchar is not None:
|
||||
+ import warnings
|
||||
+ warnings.warn(f'invalid character {chr(badchar)!a} in URL-safe Base64 data '
|
||||
+ f'will be discarded in future Python versions',
|
||||
+ FutureWarning, stacklevel=2)
|
||||
+ return result
|
||||
|
||||
|
||||
|
||||
Index: Python-3.14.3/Lib/test/test_base64.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/test/test_base64.py 2026-02-13 15:20:35.393785541 +0100
|
||||
+++ Python-3.14.3/Lib/test/test_base64.py 2026-02-13 15:43:18.031706655 +0100
|
||||
@@ -242,6 +242,25 @@
|
||||
eq(base64.b64decode(data, altchars=altchars_str), res)
|
||||
eq(base64.b64decode(data_str, altchars=altchars_str), res)
|
||||
|
||||
+ def test_b64decode_altchars(self):
|
||||
+ # Test with arbitrary alternative characters
|
||||
+ eq = self.assertEqual
|
||||
+ res = b'\xd3V\xbeo\xf7\x1d'
|
||||
+ for altchars in b'*$', b'+/', b'/+', b'+_', b'-+', b'-/', b'/_':
|
||||
+ data = b'01a%cb%ccd' % tuple(altchars)
|
||||
+ data_str = data.decode('ascii')
|
||||
+ altchars_str = altchars.decode('ascii')
|
||||
+
|
||||
+ eq(base64.b64decode(data, altchars=altchars), res)
|
||||
+ eq(base64.b64decode(data_str, altchars=altchars), res)
|
||||
+ eq(base64.b64decode(data, altchars=altchars_str), res)
|
||||
+ eq(base64.b64decode(data_str, altchars=altchars_str), res)
|
||||
+
|
||||
+ self.assertRaises(ValueError, base64.b64decode, b'', altchars=b'+')
|
||||
+ self.assertRaises(ValueError, base64.b64decode, b'', altchars=b'+/-')
|
||||
+ self.assertRaises(ValueError, base64.b64decode, '', altchars='+')
|
||||
+ self.assertRaises(ValueError, base64.b64decode, '', altchars='+/-')
|
||||
+
|
||||
def test_b64decode_padding_error(self):
|
||||
self.assertRaises(binascii.Error, base64.b64decode, b'abc')
|
||||
self.assertRaises(binascii.Error, base64.b64decode, 'abc')
|
||||
@@ -273,13 +292,25 @@
|
||||
with self.assertRaises(binascii.Error):
|
||||
base64.b64decode(bstr.decode('ascii'), validate=True)
|
||||
|
||||
- # Normal alphabet characters not discarded when alternative given
|
||||
- res = b'\xfb\xef\xff'
|
||||
- self.assertEqual(base64.b64decode(b'++//', validate=True), res)
|
||||
- self.assertEqual(base64.b64decode(b'++//', '-_', validate=True), res)
|
||||
- self.assertEqual(base64.b64decode(b'--__', '-_', validate=True), res)
|
||||
- self.assertEqual(base64.urlsafe_b64decode(b'++//'), res)
|
||||
- self.assertEqual(base64.urlsafe_b64decode(b'--__'), res)
|
||||
+ # Normal alphabet characters will be discarded when alternative given
|
||||
+ with self.assertWarns(FutureWarning):
|
||||
+ self.assertEqual(base64.b64decode(b'++++', altchars=b'-_'),
|
||||
+ b'\xfb\xef\xbe')
|
||||
+ with self.assertWarns(FutureWarning):
|
||||
+ self.assertEqual(base64.b64decode(b'////', altchars=b'-_'),
|
||||
+ b'\xff\xff\xff')
|
||||
+ with self.assertWarns(DeprecationWarning):
|
||||
+ self.assertEqual(base64.b64decode(b'++++', altchars=b'-_', validate=True),
|
||||
+ b'\xfb\xef\xbe')
|
||||
+ with self.assertWarns(DeprecationWarning):
|
||||
+ self.assertEqual(base64.b64decode(b'////', altchars=b'-_', validate=True),
|
||||
+ b'\xff\xff\xff')
|
||||
+ with self.assertWarns(FutureWarning):
|
||||
+ self.assertEqual(base64.urlsafe_b64decode(b'++++'), b'\xfb\xef\xbe')
|
||||
+ with self.assertWarns(FutureWarning):
|
||||
+ self.assertEqual(base64.urlsafe_b64decode(b'////'), b'\xff\xff\xff')
|
||||
+ with self.assertRaises(binascii.Error):
|
||||
+ base64.b64decode(b'+/!', altchars=b'-_')
|
||||
|
||||
def test_b32encode(self):
|
||||
eq = self.assertEqual
|
||||
Index: Python-3.14.3/Misc/NEWS.d/next/Library/2025-11-06-12-03-29.gh-issue-125346.7Gfpgw.rst
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ Python-3.14.3/Misc/NEWS.d/next/Library/2025-11-06-12-03-29.gh-issue-125346.7Gfpgw.rst 2026-02-13 15:43:18.032082102 +0100
|
||||
@@ -0,0 +1,5 @@
|
||||
+Accepting ``+`` and ``/`` characters with an alternative alphabet in
|
||||
+:func:`base64.b64decode` and :func:`base64.urlsafe_b64decode` is now
|
||||
+deprecated.
|
||||
+In future Python versions they will be errors in the strict mode and
|
||||
+discarded in the non-strict mode.
|
||||
56
CVE-2025-15366-imap-ctrl-chars.patch
Normal file
56
CVE-2025-15366-imap-ctrl-chars.patch
Normal file
@@ -0,0 +1,56 @@
|
||||
From 7485ee5e2cf81d3e5ad0d9c3be73cecd2ab4eec7 Mon Sep 17 00:00:00 2001
|
||||
From: Seth Michael Larson <seth@python.org>
|
||||
Date: Fri, 16 Jan 2026 10:54:09 -0600
|
||||
Subject: [PATCH 1/2] Add 'test.support' fixture for C0 control characters
|
||||
|
||||
---
|
||||
Lib/imaplib.py | 4 +++-
|
||||
Lib/test/test_imaplib.py | 6 ++++++
|
||||
Misc/NEWS.d/next/Security/2026-01-16-11-41-06.gh-issue-143921.AeCOor.rst | 1 +
|
||||
3 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: Python-3.14.3/Lib/imaplib.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/imaplib.py 2026-02-13 15:20:34.675850664 +0100
|
||||
+++ Python-3.14.3/Lib/imaplib.py 2026-02-13 15:43:20.726880248 +0100
|
||||
@@ -131,7 +131,7 @@
|
||||
# We compile these in _mode_xxx.
|
||||
_Literal = br'.*{(?P<size>\d+)}$'
|
||||
_Untagged_status = br'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?'
|
||||
-
|
||||
+_control_chars = re.compile(b'[\x00-\x1F\x7F]')
|
||||
|
||||
|
||||
class IMAP4:
|
||||
@@ -1108,6 +1108,8 @@
|
||||
if arg is None: continue
|
||||
if isinstance(arg, str):
|
||||
arg = bytes(arg, self._encoding)
|
||||
+ if _control_chars.search(arg):
|
||||
+ raise ValueError("Control characters not allowed in commands")
|
||||
data = data + b' ' + arg
|
||||
|
||||
literal = self.literal
|
||||
Index: Python-3.14.3/Lib/test/test_imaplib.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/test/test_imaplib.py 2026-02-13 15:20:36.132236378 +0100
|
||||
+++ Python-3.14.3/Lib/test/test_imaplib.py 2026-02-13 15:43:20.727593302 +0100
|
||||
@@ -663,6 +663,12 @@
|
||||
self.assertEqual(data[0], b'Returned to authenticated state. (Success)')
|
||||
self.assertEqual(client.state, 'AUTH')
|
||||
|
||||
+ def test_control_characters(self):
|
||||
+ client, _ = self._setup(SimpleIMAPHandler)
|
||||
+ for c0 in support.control_characters_c0():
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ client.login(f'user{c0}', 'pass')
|
||||
+
|
||||
# property tests
|
||||
|
||||
def test_file_property_should_not_be_accessed(self):
|
||||
Index: Python-3.14.3/Misc/NEWS.d/next/Security/2026-01-16-11-41-06.gh-issue-143921.AeCOor.rst
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ Python-3.14.3/Misc/NEWS.d/next/Security/2026-01-16-11-41-06.gh-issue-143921.AeCOor.rst 2026-02-13 15:43:20.727873249 +0100
|
||||
@@ -0,0 +1 @@
|
||||
+Reject control characters in IMAP commands.
|
||||
56
CVE-2025-15367-poplib-ctrl-chars.patch
Normal file
56
CVE-2025-15367-poplib-ctrl-chars.patch
Normal file
@@ -0,0 +1,56 @@
|
||||
From b6f733b285b1c4f27dacb5c2e1f292c914e8b933 Mon Sep 17 00:00:00 2001
|
||||
From: Seth Michael Larson <seth@python.org>
|
||||
Date: Fri, 16 Jan 2026 10:54:09 -0600
|
||||
Subject: [PATCH 1/2] Add 'test.support' fixture for C0 control characters
|
||||
|
||||
---
|
||||
Lib/poplib.py | 2 ++
|
||||
Lib/test/test_poplib.py | 8 ++++++++
|
||||
Misc/NEWS.d/next/Security/2026-01-16-11-43-47.gh-issue-143923.DuytMe.rst | 1 +
|
||||
3 files changed, 11 insertions(+)
|
||||
|
||||
Index: Python-3.14.3/Lib/poplib.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/poplib.py 2026-02-13 15:20:34.865869684 +0100
|
||||
+++ Python-3.14.3/Lib/poplib.py 2026-02-13 15:43:22.865622881 +0100
|
||||
@@ -122,6 +122,8 @@
|
||||
def _putcmd(self, line):
|
||||
if self._debugging: print('*cmd*', repr(line))
|
||||
line = bytes(line, self.encoding)
|
||||
+ if re.search(b'[\x00-\x1F\x7F]', line):
|
||||
+ raise ValueError('Control characters not allowed in commands')
|
||||
self._putline(line)
|
||||
|
||||
|
||||
Index: Python-3.14.3/Lib/test/test_poplib.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Lib/test/test_poplib.py 2026-02-13 15:20:36.695240465 +0100
|
||||
+++ Python-3.14.3/Lib/test/test_poplib.py 2026-02-13 15:43:22.865782353 +0100
|
||||
@@ -17,6 +17,7 @@
|
||||
from test.support import threading_helper
|
||||
from test.support import asynchat
|
||||
from test.support import asyncore
|
||||
+from test.support import control_characters_c0
|
||||
|
||||
|
||||
test_support.requires_working_socket(module=True)
|
||||
@@ -395,6 +396,13 @@
|
||||
self.assertIsNone(self.client.sock)
|
||||
self.assertIsNone(self.client.file)
|
||||
|
||||
+ def test_control_characters(self):
|
||||
+ for c0 in control_characters_c0():
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ self.client.user(f'user{c0}')
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ self.client.pass_(f'{c0}pass')
|
||||
+
|
||||
@requires_ssl
|
||||
def test_stls_capa(self):
|
||||
capa = self.client.capa()
|
||||
Index: Python-3.14.3/Misc/NEWS.d/next/Security/2026-01-16-11-43-47.gh-issue-143923.DuytMe.rst
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ Python-3.14.3/Misc/NEWS.d/next/Security/2026-01-16-11-43-47.gh-issue-143923.DuytMe.rst 2026-02-13 15:43:22.866393092 +0100
|
||||
@@ -0,0 +1 @@
|
||||
+Reject control characters in POP3 commands.
|
||||
@@ -1,374 +0,0 @@
|
||||
From 5c0bf5295a6a38ee7540e447bcdc4889d131e261 Mon Sep 17 00:00:00 2001
|
||||
From: Serhiy Storchaka <storchaka@gmail.com>
|
||||
Date: Fri, 31 Oct 2025 15:49:51 +0200
|
||||
Subject: [PATCH] [3.14] gh-136065: Fix quadratic complexity in
|
||||
os.path.expandvars() (GH-134952) (cherry picked from commit
|
||||
f029e8db626ddc6e3a3beea4eff511a71aaceb5c)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
||||
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
||||
---
|
||||
Lib/ntpath.py | 126 ++++++------------
|
||||
Lib/posixpath.py | 43 +++---
|
||||
Lib/test/test_genericpath.py | 21 ++-
|
||||
Lib/test/test_ntpath.py | 22 ++-
|
||||
...-05-30-22-33-27.gh-issue-136065.bu337o.rst | 1 +
|
||||
5 files changed, 96 insertions(+), 117 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2025-05-30-22-33-27.gh-issue-136065.bu337o.rst
|
||||
|
||||
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
|
||||
index 9cdc16480f9afe..01f060e70beed9 100644
|
||||
--- a/Lib/ntpath.py
|
||||
+++ b/Lib/ntpath.py
|
||||
@@ -400,17 +400,23 @@ def expanduser(path):
|
||||
# XXX With COMMAND.COM you can use any characters in a variable name,
|
||||
# XXX except '^|<>='.
|
||||
|
||||
+_varpattern = r"'[^']*'?|%(%|[^%]*%?)|\$(\$|[-\w]+|\{[^}]*\}?)"
|
||||
+_varsub = None
|
||||
+_varsubb = None
|
||||
+
|
||||
def expandvars(path):
|
||||
"""Expand shell variables of the forms $var, ${var} and %var%.
|
||||
|
||||
Unknown variables are left unchanged."""
|
||||
path = os.fspath(path)
|
||||
+ global _varsub, _varsubb
|
||||
if isinstance(path, bytes):
|
||||
if b'$' not in path and b'%' not in path:
|
||||
return path
|
||||
- import string
|
||||
- varchars = bytes(string.ascii_letters + string.digits + '_-', 'ascii')
|
||||
- quote = b'\''
|
||||
+ if not _varsubb:
|
||||
+ import re
|
||||
+ _varsubb = re.compile(_varpattern.encode(), re.ASCII).sub
|
||||
+ sub = _varsubb
|
||||
percent = b'%'
|
||||
brace = b'{'
|
||||
rbrace = b'}'
|
||||
@@ -419,94 +425,44 @@ def expandvars(path):
|
||||
else:
|
||||
if '$' not in path and '%' not in path:
|
||||
return path
|
||||
- import string
|
||||
- varchars = string.ascii_letters + string.digits + '_-'
|
||||
- quote = '\''
|
||||
+ if not _varsub:
|
||||
+ import re
|
||||
+ _varsub = re.compile(_varpattern, re.ASCII).sub
|
||||
+ sub = _varsub
|
||||
percent = '%'
|
||||
brace = '{'
|
||||
rbrace = '}'
|
||||
dollar = '$'
|
||||
environ = os.environ
|
||||
- res = path[:0]
|
||||
- index = 0
|
||||
- pathlen = len(path)
|
||||
- while index < pathlen:
|
||||
- c = path[index:index+1]
|
||||
- if c == quote: # no expansion within single quotes
|
||||
- path = path[index + 1:]
|
||||
- pathlen = len(path)
|
||||
- try:
|
||||
- index = path.index(c)
|
||||
- res += c + path[:index + 1]
|
||||
- except ValueError:
|
||||
- res += c + path
|
||||
- index = pathlen - 1
|
||||
- elif c == percent: # variable or '%'
|
||||
- if path[index + 1:index + 2] == percent:
|
||||
- res += c
|
||||
- index += 1
|
||||
- else:
|
||||
- path = path[index+1:]
|
||||
- pathlen = len(path)
|
||||
- try:
|
||||
- index = path.index(percent)
|
||||
- except ValueError:
|
||||
- res += percent + path
|
||||
- index = pathlen - 1
|
||||
- else:
|
||||
- var = path[:index]
|
||||
- try:
|
||||
- if environ is None:
|
||||
- value = os.fsencode(os.environ[os.fsdecode(var)])
|
||||
- else:
|
||||
- value = environ[var]
|
||||
- except KeyError:
|
||||
- value = percent + var + percent
|
||||
- res += value
|
||||
- elif c == dollar: # variable or '$$'
|
||||
- if path[index + 1:index + 2] == dollar:
|
||||
- res += c
|
||||
- index += 1
|
||||
- elif path[index + 1:index + 2] == brace:
|
||||
- path = path[index+2:]
|
||||
- pathlen = len(path)
|
||||
- try:
|
||||
- index = path.index(rbrace)
|
||||
- except ValueError:
|
||||
- res += dollar + brace + path
|
||||
- index = pathlen - 1
|
||||
- else:
|
||||
- var = path[:index]
|
||||
- try:
|
||||
- if environ is None:
|
||||
- value = os.fsencode(os.environ[os.fsdecode(var)])
|
||||
- else:
|
||||
- value = environ[var]
|
||||
- except KeyError:
|
||||
- value = dollar + brace + var + rbrace
|
||||
- res += value
|
||||
- else:
|
||||
- var = path[:0]
|
||||
- index += 1
|
||||
- c = path[index:index + 1]
|
||||
- while c and c in varchars:
|
||||
- var += c
|
||||
- index += 1
|
||||
- c = path[index:index + 1]
|
||||
- try:
|
||||
- if environ is None:
|
||||
- value = os.fsencode(os.environ[os.fsdecode(var)])
|
||||
- else:
|
||||
- value = environ[var]
|
||||
- except KeyError:
|
||||
- value = dollar + var
|
||||
- res += value
|
||||
- if c:
|
||||
- index -= 1
|
||||
+
|
||||
+ def repl(m):
|
||||
+ lastindex = m.lastindex
|
||||
+ if lastindex is None:
|
||||
+ return m[0]
|
||||
+ name = m[lastindex]
|
||||
+ if lastindex == 1:
|
||||
+ if name == percent:
|
||||
+ return name
|
||||
+ if not name.endswith(percent):
|
||||
+ return m[0]
|
||||
+ name = name[:-1]
|
||||
else:
|
||||
- res += c
|
||||
- index += 1
|
||||
- return res
|
||||
+ if name == dollar:
|
||||
+ return name
|
||||
+ if name.startswith(brace):
|
||||
+ if not name.endswith(rbrace):
|
||||
+ return m[0]
|
||||
+ name = name[1:-1]
|
||||
+
|
||||
+ try:
|
||||
+ if environ is None:
|
||||
+ return os.fsencode(os.environ[os.fsdecode(name)])
|
||||
+ else:
|
||||
+ return environ[name]
|
||||
+ except KeyError:
|
||||
+ return m[0]
|
||||
+
|
||||
+ return sub(repl, path)
|
||||
|
||||
|
||||
# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A\B.
|
||||
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
|
||||
index d38f3bd5872bcd..ad86cc06c017a0 100644
|
||||
--- a/Lib/posixpath.py
|
||||
+++ b/Lib/posixpath.py
|
||||
@@ -284,42 +284,41 @@ def expanduser(path):
|
||||
# This expands the forms $variable and ${variable} only.
|
||||
# Non-existent variables are left unchanged.
|
||||
|
||||
-_varprog = None
|
||||
-_varprogb = None
|
||||
+_varpattern = r'\$(\w+|\{[^}]*\}?)'
|
||||
+_varsub = None
|
||||
+_varsubb = None
|
||||
|
||||
def expandvars(path):
|
||||
"""Expand shell variables of form $var and ${var}. Unknown variables
|
||||
are left unchanged."""
|
||||
path = os.fspath(path)
|
||||
- global _varprog, _varprogb
|
||||
+ global _varsub, _varsubb
|
||||
if isinstance(path, bytes):
|
||||
if b'$' not in path:
|
||||
return path
|
||||
- if not _varprogb:
|
||||
+ if not _varsubb:
|
||||
import re
|
||||
- _varprogb = re.compile(br'\$(\w+|\{[^}]*\})', re.ASCII)
|
||||
- search = _varprogb.search
|
||||
+ _varsubb = re.compile(_varpattern.encode(), re.ASCII).sub
|
||||
+ sub = _varsubb
|
||||
start = b'{'
|
||||
end = b'}'
|
||||
environ = getattr(os, 'environb', None)
|
||||
else:
|
||||
if '$' not in path:
|
||||
return path
|
||||
- if not _varprog:
|
||||
+ if not _varsub:
|
||||
import re
|
||||
- _varprog = re.compile(r'\$(\w+|\{[^}]*\})', re.ASCII)
|
||||
- search = _varprog.search
|
||||
+ _varsub = re.compile(_varpattern, re.ASCII).sub
|
||||
+ sub = _varsub
|
||||
start = '{'
|
||||
end = '}'
|
||||
environ = os.environ
|
||||
- i = 0
|
||||
- while True:
|
||||
- m = search(path, i)
|
||||
- if not m:
|
||||
- break
|
||||
- i, j = m.span(0)
|
||||
- name = m.group(1)
|
||||
- if name.startswith(start) and name.endswith(end):
|
||||
+
|
||||
+ def repl(m):
|
||||
+ name = m[1]
|
||||
+ if name.startswith(start):
|
||||
+ if not name.endswith(end):
|
||||
+ return m[0]
|
||||
name = name[1:-1]
|
||||
try:
|
||||
if environ is None:
|
||||
@@ -327,13 +326,11 @@ def expandvars(path):
|
||||
else:
|
||||
value = environ[name]
|
||||
except KeyError:
|
||||
- i = j
|
||||
+ return m[0]
|
||||
else:
|
||||
- tail = path[j:]
|
||||
- path = path[:i] + value
|
||||
- i = len(path)
|
||||
- path += tail
|
||||
- return path
|
||||
+ return value
|
||||
+
|
||||
+ return sub(repl, path)
|
||||
|
||||
|
||||
# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
|
||||
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
|
||||
index df07af01fc7540..1a44cedcd360b1 100644
|
||||
--- a/Lib/test/test_genericpath.py
|
||||
+++ b/Lib/test/test_genericpath.py
|
||||
@@ -7,9 +7,9 @@
|
||||
import sys
|
||||
import unittest
|
||||
import warnings
|
||||
-from test.support import (
|
||||
- is_apple, is_emscripten, os_helper, warnings_helper
|
||||
-)
|
||||
+from test import support
|
||||
+from test.support import os_helper
|
||||
+from test.support import warnings_helper
|
||||
from test.support.script_helper import assert_python_ok
|
||||
from test.support.os_helper import FakePath
|
||||
|
||||
@@ -445,6 +445,19 @@ def check(value, expected):
|
||||
os.fsencode('$bar%s bar' % nonascii))
|
||||
check(b'$spam}bar', os.fsencode('%s}bar' % nonascii))
|
||||
|
||||
+ @support.requires_resource('cpu')
|
||||
+ def test_expandvars_large(self):
|
||||
+ expandvars = self.pathmodule.expandvars
|
||||
+ with os_helper.EnvironmentVarGuard() as env:
|
||||
+ env.clear()
|
||||
+ env["A"] = "B"
|
||||
+ n = 100_000
|
||||
+ self.assertEqual(expandvars('$A'*n), 'B'*n)
|
||||
+ self.assertEqual(expandvars('${A}'*n), 'B'*n)
|
||||
+ self.assertEqual(expandvars('$A!'*n), 'B!'*n)
|
||||
+ self.assertEqual(expandvars('${A}A'*n), 'BA'*n)
|
||||
+ self.assertEqual(expandvars('${'*10*n), '${'*10*n)
|
||||
+
|
||||
def test_abspath(self):
|
||||
self.assertIn("foo", self.pathmodule.abspath("foo"))
|
||||
with warnings.catch_warnings():
|
||||
@@ -502,7 +515,7 @@ def test_nonascii_abspath(self):
|
||||
# directory (when the bytes name is used).
|
||||
and sys.platform not in {
|
||||
"win32", "emscripten", "wasi"
|
||||
- } and not is_apple
|
||||
+ } and not support.is_apple
|
||||
):
|
||||
name = os_helper.TESTFN_UNDECODABLE
|
||||
elif os_helper.TESTFN_NONASCII:
|
||||
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
|
||||
index 03bfccf260b25d..9270f3257068d6 100644
|
||||
--- a/Lib/test/test_ntpath.py
|
||||
+++ b/Lib/test/test_ntpath.py
|
||||
@@ -7,8 +7,7 @@
|
||||
import unittest
|
||||
import warnings
|
||||
from test import support
|
||||
-from test.support import cpython_only, os_helper
|
||||
-from test.support import TestFailed
|
||||
+from test.support import os_helper
|
||||
from ntpath import ALLOW_MISSING
|
||||
from test.support.os_helper import FakePath
|
||||
from test import test_genericpath
|
||||
@@ -59,7 +58,7 @@ def tester(fn, wantResult):
|
||||
fn = fn.replace("\\", "\\\\")
|
||||
gotResult = eval(fn)
|
||||
if wantResult != gotResult and _norm(wantResult) != _norm(gotResult):
|
||||
- raise TestFailed("%s should return: %s but returned: %s" \
|
||||
+ raise support.TestFailed("%s should return: %s but returned: %s" \
|
||||
%(str(fn), str(wantResult), str(gotResult)))
|
||||
|
||||
# then with bytes
|
||||
@@ -75,7 +74,7 @@ def tester(fn, wantResult):
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
gotResult = eval(fn)
|
||||
if _norm(wantResult) != _norm(gotResult):
|
||||
- raise TestFailed("%s should return: %s but returned: %s" \
|
||||
+ raise support.TestFailed("%s should return: %s but returned: %s" \
|
||||
%(str(fn), str(wantResult), repr(gotResult)))
|
||||
|
||||
|
||||
@@ -1022,6 +1021,19 @@ def check(value, expected):
|
||||
check('%spam%bar', '%sbar' % nonascii)
|
||||
check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
|
||||
|
||||
+ @support.requires_resource('cpu')
|
||||
+ def test_expandvars_large(self):
|
||||
+ expandvars = ntpath.expandvars
|
||||
+ with os_helper.EnvironmentVarGuard() as env:
|
||||
+ env.clear()
|
||||
+ env["A"] = "B"
|
||||
+ n = 100_000
|
||||
+ self.assertEqual(expandvars('%A%'*n), 'B'*n)
|
||||
+ self.assertEqual(expandvars('%A%A'*n), 'BA'*n)
|
||||
+ self.assertEqual(expandvars("''"*n + '%%'), "''"*n + '%')
|
||||
+ self.assertEqual(expandvars("%%"*n), "%"*n)
|
||||
+ self.assertEqual(expandvars("$$"*n), "$"*n)
|
||||
+
|
||||
def test_expanduser(self):
|
||||
tester('ntpath.expanduser("test")', 'test')
|
||||
|
||||
@@ -1439,7 +1451,7 @@ def test_con_device(self):
|
||||
self.assertTrue(os.path.exists(r"\\.\CON"))
|
||||
|
||||
@unittest.skipIf(sys.platform != 'win32', "Fast paths are only for win32")
|
||||
- @cpython_only
|
||||
+ @support.cpython_only
|
||||
def test_fast_paths_in_use(self):
|
||||
# There are fast paths of these functions implemented in posixmodule.c.
|
||||
# Confirm that they are being used, and not the Python fallbacks in
|
||||
diff --git a/Misc/NEWS.d/next/Security/2025-05-30-22-33-27.gh-issue-136065.bu337o.rst b/Misc/NEWS.d/next/Security/2025-05-30-22-33-27.gh-issue-136065.bu337o.rst
|
||||
new file mode 100644
|
||||
index 00000000000000..1d152bb5318380
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2025-05-30-22-33-27.gh-issue-136065.bu337o.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Fix quadratic complexity in :func:`os.path.expandvars`.
|
||||
@@ -1,306 +0,0 @@
|
||||
From 5454f861e2b3c96fa1e6430dc952544670955f69 Mon Sep 17 00:00:00 2001
|
||||
From: Serhiy Storchaka <storchaka@gmail.com>
|
||||
Date: Tue, 7 Oct 2025 20:15:26 +0300
|
||||
Subject: [PATCH] gh-139700: Check consistency of the zip64 end of central
|
||||
directory record (GH-139702)
|
||||
|
||||
Support records with "zip64 extensible data" if there are no bytes
|
||||
prepended to the ZIP file.
|
||||
(cherry picked from commit 162997bb70e067668c039700141770687bc8f267)
|
||||
|
||||
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
||||
---
|
||||
Lib/test/test_zipfile/test_core.py | 82 +++++++++-
|
||||
Lib/zipfile/__init__.py | 51 +++---
|
||||
Misc/NEWS.d/next/Security/2025-10-07-19-31-34.gh-issue-139700.vNHU1O.rst | 3
|
||||
3 files changed, 113 insertions(+), 23 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2025-10-07-19-31-34.gh-issue-139700.vNHU1O.rst
|
||||
|
||||
Index: Python-3.14.0/Lib/test/test_zipfile/test_core.py
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Lib/test/test_zipfile/test_core.py 2025-11-12 01:03:54.947094045 +0100
|
||||
+++ Python-3.14.0/Lib/test/test_zipfile/test_core.py 2025-11-12 01:04:11.766432381 +0100
|
||||
@@ -898,6 +898,8 @@
|
||||
self, file_size_64_set=False, file_size_extra=False,
|
||||
compress_size_64_set=False, compress_size_extra=False,
|
||||
header_offset_64_set=False, header_offset_extra=False,
|
||||
+ extensible_data=b'',
|
||||
+ end_of_central_dir_size=None, offset_to_end_of_central_dir=None,
|
||||
):
|
||||
"""Generate bytes sequence for a zip with (incomplete) zip64 data.
|
||||
|
||||
@@ -951,6 +953,12 @@
|
||||
|
||||
central_dir_size = struct.pack('<Q', 58 + 8 * len(central_zip64_fields))
|
||||
offset_to_central_dir = struct.pack('<Q', 50 + 8 * len(local_zip64_fields))
|
||||
+ if end_of_central_dir_size is None:
|
||||
+ end_of_central_dir_size = 44 + len(extensible_data)
|
||||
+ if offset_to_end_of_central_dir is None:
|
||||
+ offset_to_end_of_central_dir = (108
|
||||
+ + 8 * len(local_zip64_fields)
|
||||
+ + 8 * len(central_zip64_fields))
|
||||
|
||||
local_extra_length = struct.pack("<H", 4 + 8 * len(local_zip64_fields))
|
||||
central_extra_length = struct.pack("<H", 4 + 8 * len(central_zip64_fields))
|
||||
@@ -979,14 +987,17 @@
|
||||
+ filename
|
||||
+ central_extra
|
||||
# Zip64 end of central directory
|
||||
- + b"PK\x06\x06,\x00\x00\x00\x00\x00\x00\x00-\x00-"
|
||||
- + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00"
|
||||
+ + b"PK\x06\x06"
|
||||
+ + struct.pack('<Q', end_of_central_dir_size)
|
||||
+ + b"-\x00-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00"
|
||||
+ b"\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00"
|
||||
+ central_dir_size
|
||||
+ offset_to_central_dir
|
||||
+ + extensible_data
|
||||
# Zip64 end of central directory locator
|
||||
- + b"PK\x06\x07\x00\x00\x00\x00l\x00\x00\x00\x00\x00\x00\x00\x01"
|
||||
- + b"\x00\x00\x00"
|
||||
+ + b"PK\x06\x07\x00\x00\x00\x00"
|
||||
+ + struct.pack('<Q', offset_to_end_of_central_dir)
|
||||
+ + b"\x01\x00\x00\x00"
|
||||
# end of central directory
|
||||
+ b"PK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00:\x00\x00\x002\x00"
|
||||
+ b"\x00\x00\x00\x00"
|
||||
@@ -1017,6 +1028,7 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_file_size_extra))
|
||||
self.assertIn('file size', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_file_size_extra)))
|
||||
|
||||
# zip64 file size present, zip64 compress size present, one field in
|
||||
# extra, expecting two, equals missing compress size.
|
||||
@@ -1028,6 +1040,7 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_compress_size_extra))
|
||||
self.assertIn('compress size', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_compress_size_extra)))
|
||||
|
||||
# zip64 compress size present, no fields in extra, expecting one,
|
||||
# equals missing compress size.
|
||||
@@ -1037,6 +1050,7 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_compress_size_extra))
|
||||
self.assertIn('compress size', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_compress_size_extra)))
|
||||
|
||||
# zip64 file size present, zip64 compress size present, zip64 header
|
||||
# offset present, two fields in extra, expecting three, equals missing
|
||||
@@ -1051,6 +1065,7 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_header_offset_extra))
|
||||
self.assertIn('header offset', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_header_offset_extra)))
|
||||
|
||||
# zip64 compress size present, zip64 header offset present, one field
|
||||
# in extra, expecting two, equals missing header offset
|
||||
@@ -1063,6 +1078,7 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_header_offset_extra))
|
||||
self.assertIn('header offset', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_header_offset_extra)))
|
||||
|
||||
# zip64 file size present, zip64 header offset present, one field in
|
||||
# extra, expecting two, equals missing header offset
|
||||
@@ -1075,6 +1091,7 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_header_offset_extra))
|
||||
self.assertIn('header offset', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_header_offset_extra)))
|
||||
|
||||
# zip64 header offset present, no fields in extra, expecting one,
|
||||
# equals missing header offset
|
||||
@@ -1086,6 +1103,63 @@
|
||||
with self.assertRaises(zipfile.BadZipFile) as e:
|
||||
zipfile.ZipFile(io.BytesIO(missing_header_offset_extra))
|
||||
self.assertIn('header offset', str(e.exception).lower())
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(missing_header_offset_extra)))
|
||||
+
|
||||
+ def test_bad_zip64_end_of_central_dir(self):
|
||||
+ zipdata = self.make_zip64_file(end_of_central_dir_size=0)
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'Corrupt.*record'):
|
||||
+ zipfile.ZipFile(io.BytesIO(zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ zipdata = self.make_zip64_file(end_of_central_dir_size=100)
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'Corrupt.*record'):
|
||||
+ zipfile.ZipFile(io.BytesIO(zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ zipdata = self.make_zip64_file(offset_to_end_of_central_dir=0)
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'Corrupt.*record'):
|
||||
+ zipfile.ZipFile(io.BytesIO(zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ zipdata = self.make_zip64_file(offset_to_end_of_central_dir=1000)
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'Corrupt.*locator'):
|
||||
+ zipfile.ZipFile(io.BytesIO(zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ def test_zip64_end_of_central_dir_record_not_found(self):
|
||||
+ zipdata = self.make_zip64_file()
|
||||
+ zipdata = zipdata.replace(b"PK\x06\x06", b'\x00'*4)
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'record not found'):
|
||||
+ zipfile.ZipFile(io.BytesIO(zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ zipdata = self.make_zip64_file(
|
||||
+ extensible_data=b'\xca\xfe\x04\x00\x00\x00data')
|
||||
+ zipdata = zipdata.replace(b"PK\x06\x06", b'\x00'*4)
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'record not found'):
|
||||
+ zipfile.ZipFile(io.BytesIO(zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ def test_zip64_extensible_data(self):
|
||||
+ # These values are what is set in the make_zip64_file method.
|
||||
+ expected_file_size = 8
|
||||
+ expected_compress_size = 8
|
||||
+ expected_header_offset = 0
|
||||
+ expected_content = b"test1234"
|
||||
+
|
||||
+ zipdata = self.make_zip64_file(
|
||||
+ extensible_data=b'\xca\xfe\x04\x00\x00\x00data')
|
||||
+ with zipfile.ZipFile(io.BytesIO(zipdata)) as zf:
|
||||
+ zinfo = zf.infolist()[0]
|
||||
+ self.assertEqual(zinfo.file_size, expected_file_size)
|
||||
+ self.assertEqual(zinfo.compress_size, expected_compress_size)
|
||||
+ self.assertEqual(zinfo.header_offset, expected_header_offset)
|
||||
+ self.assertEqual(zf.read(zinfo), expected_content)
|
||||
+ self.assertTrue(zipfile.is_zipfile(io.BytesIO(zipdata)))
|
||||
+
|
||||
+ with self.assertRaisesRegex(zipfile.BadZipFile, 'record not found'):
|
||||
+ zipfile.ZipFile(io.BytesIO(b'prepended' + zipdata))
|
||||
+ self.assertFalse(zipfile.is_zipfile(io.BytesIO(b'prepended' + zipdata)))
|
||||
|
||||
def test_generated_valid_zip64_extra(self):
|
||||
# These values are what is set in the make_zip64_file method.
|
||||
Index: Python-3.14.0/Lib/zipfile/__init__.py
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Lib/zipfile/__init__.py 2025-11-12 01:03:55.239347604 +0100
|
||||
+++ Python-3.14.0/Lib/zipfile/__init__.py 2025-11-12 01:04:11.767105446 +0100
|
||||
@@ -265,7 +265,7 @@
|
||||
else:
|
||||
with open(filename, "rb") as fp:
|
||||
result = _check_zipfile(fp)
|
||||
- except OSError:
|
||||
+ except (OSError, BadZipFile):
|
||||
pass
|
||||
return result
|
||||
|
||||
@@ -275,9 +275,6 @@
|
||||
|
||||
# "concat" is zero, unless zip was concatenated to another file
|
||||
concat = endrec[_ECD_LOCATION] - size_cd - offset_cd
|
||||
- if endrec[_ECD_SIGNATURE] == stringEndArchive64:
|
||||
- # If Zip64 extension structures are present, account for them
|
||||
- concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator)
|
||||
|
||||
if debug > 2:
|
||||
inferred = concat + offset_cd
|
||||
@@ -289,16 +286,15 @@
|
||||
"""
|
||||
Read the ZIP64 end-of-archive records and use that to update endrec
|
||||
"""
|
||||
- try:
|
||||
- fpin.seek(offset - sizeEndCentDir64Locator, 2)
|
||||
- except OSError:
|
||||
- # If the seek fails, the file is not large enough to contain a ZIP64
|
||||
+ offset -= sizeEndCentDir64Locator
|
||||
+ if offset < 0:
|
||||
+ # The file is not large enough to contain a ZIP64
|
||||
# end-of-archive record, so just return the end record we were given.
|
||||
return endrec
|
||||
-
|
||||
+ fpin.seek(offset)
|
||||
data = fpin.read(sizeEndCentDir64Locator)
|
||||
if len(data) != sizeEndCentDir64Locator:
|
||||
- return endrec
|
||||
+ raise OSError("Unknown I/O error")
|
||||
sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data)
|
||||
if sig != stringEndArchive64Locator:
|
||||
return endrec
|
||||
@@ -306,16 +302,33 @@
|
||||
if diskno != 0 or disks > 1:
|
||||
raise BadZipFile("zipfiles that span multiple disks are not supported")
|
||||
|
||||
- # Assume no 'zip64 extensible data'
|
||||
- fpin.seek(offset - sizeEndCentDir64Locator - sizeEndCentDir64, 2)
|
||||
+ offset -= sizeEndCentDir64
|
||||
+ if reloff > offset:
|
||||
+ raise BadZipFile("Corrupt zip64 end of central directory locator")
|
||||
+ # First, check the assumption that there is no prepended data.
|
||||
+ fpin.seek(reloff)
|
||||
+ extrasz = offset - reloff
|
||||
data = fpin.read(sizeEndCentDir64)
|
||||
if len(data) != sizeEndCentDir64:
|
||||
- return endrec
|
||||
+ raise OSError("Unknown I/O error")
|
||||
+ if not data.startswith(stringEndArchive64) and reloff != offset:
|
||||
+ # Since we already have seen the Zip64 EOCD Locator, it's
|
||||
+ # possible we got here because there is prepended data.
|
||||
+ # Assume no 'zip64 extensible data'
|
||||
+ fpin.seek(offset)
|
||||
+ extrasz = 0
|
||||
+ data = fpin.read(sizeEndCentDir64)
|
||||
+ if len(data) != sizeEndCentDir64:
|
||||
+ raise OSError("Unknown I/O error")
|
||||
+ if not data.startswith(stringEndArchive64):
|
||||
+ raise BadZipFile("Zip64 end of central directory record not found")
|
||||
+
|
||||
sig, sz, create_version, read_version, disk_num, disk_dir, \
|
||||
dircount, dircount2, dirsize, diroffset = \
|
||||
struct.unpack(structEndArchive64, data)
|
||||
- if sig != stringEndArchive64:
|
||||
- return endrec
|
||||
+ if (diroffset + dirsize != reloff or
|
||||
+ sz + 12 != sizeEndCentDir64 + extrasz):
|
||||
+ raise BadZipFile("Corrupt zip64 end of central directory record")
|
||||
|
||||
# Update the original endrec using data from the ZIP64 record
|
||||
endrec[_ECD_SIGNATURE] = sig
|
||||
@@ -325,6 +338,7 @@
|
||||
endrec[_ECD_ENTRIES_TOTAL] = dircount2
|
||||
endrec[_ECD_SIZE] = dirsize
|
||||
endrec[_ECD_OFFSET] = diroffset
|
||||
+ endrec[_ECD_LOCATION] = offset - extrasz
|
||||
return endrec
|
||||
|
||||
|
||||
@@ -358,7 +372,7 @@
|
||||
endrec.append(filesize - sizeEndCentDir)
|
||||
|
||||
# Try to read the "Zip64 end of central directory" structure
|
||||
- return _EndRecData64(fpin, -sizeEndCentDir, endrec)
|
||||
+ return _EndRecData64(fpin, filesize - sizeEndCentDir, endrec)
|
||||
|
||||
# Either this is not a ZIP file, or it is a ZIP file with an archive
|
||||
# comment. Search the end of the file for the "end of central directory"
|
||||
@@ -382,8 +396,7 @@
|
||||
endrec.append(maxCommentStart + start)
|
||||
|
||||
# Try to read the "Zip64 end of central directory" structure
|
||||
- return _EndRecData64(fpin, maxCommentStart + start - filesize,
|
||||
- endrec)
|
||||
+ return _EndRecData64(fpin, maxCommentStart + start, endrec)
|
||||
|
||||
# Unable to find a valid end of central directory structure
|
||||
return None
|
||||
@@ -2142,7 +2155,7 @@
|
||||
" would require ZIP64 extensions")
|
||||
zip64endrec = struct.pack(
|
||||
structEndArchive64, stringEndArchive64,
|
||||
- 44, 45, 45, 0, 0, centDirCount, centDirCount,
|
||||
+ sizeEndCentDir64 - 12, 45, 45, 0, 0, centDirCount, centDirCount,
|
||||
centDirSize, centDirOffset)
|
||||
self.fp.write(zip64endrec)
|
||||
|
||||
Index: Python-3.14.0/Misc/NEWS.d/next/Security/2025-10-07-19-31-34.gh-issue-139700.vNHU1O.rst
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ Python-3.14.0/Misc/NEWS.d/next/Security/2025-10-07-19-31-34.gh-issue-139700.vNHU1O.rst 2025-11-12 01:04:11.767493557 +0100
|
||||
@@ -0,0 +1,3 @@
|
||||
+Check consistency of the zip64 end of central directory record. Support
|
||||
+records with "zip64 extensible data" if there are no bytes prepended to the
|
||||
+ZIP file.
|
||||
BIN
Python-3.14.0.tar.xz
LFS
BIN
Python-3.14.0.tar.xz
LFS
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
Python-3.14.3.tar.xz
LFS
Normal file
BIN
Python-3.14.3.tar.xz
LFS
Normal file
Binary file not shown.
1
Python-3.14.3.tar.xz.sigstore
Normal file
1
Python-3.14.3.tar.xz.sigstore
Normal file
File diff suppressed because one or more lines are too long
@@ -13,11 +13,11 @@ Co-Authored-By: Xavier de Gaye <xdegaye@gmail.com>
|
||||
5 files changed, 37 insertions(+), 9 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
||||
|
||||
Index: Python-3.14.0rc1/Doc/library/ensurepip.rst
|
||||
Index: Python-3.14.2/Doc/library/ensurepip.rst
|
||||
===================================================================
|
||||
--- Python-3.14.0rc1.orig/Doc/library/ensurepip.rst 2025-07-22 18:42:44.000000000 +0200
|
||||
+++ Python-3.14.0rc1/Doc/library/ensurepip.rst 2025-07-23 10:10:31.690342385 +0200
|
||||
@@ -61,7 +61,11 @@
|
||||
--- Python-3.14.2.orig/Doc/library/ensurepip.rst 2025-12-11 18:11:54.214805989 +0100
|
||||
+++ Python-3.14.2/Doc/library/ensurepip.rst 2025-12-11 18:12:02.573781892 +0100
|
||||
@@ -65,7 +65,11 @@
|
||||
By default, ``pip`` is installed into the current virtual environment
|
||||
(if one is active) or into the system site packages (if there is no
|
||||
active virtual environment). The installation location can be controlled
|
||||
@@ -30,7 +30,7 @@ Index: Python-3.14.0rc1/Doc/library/ensurepip.rst
|
||||
|
||||
.. option:: --root <dir>
|
||||
|
||||
@@ -102,7 +106,7 @@
|
||||
@@ -106,7 +110,7 @@
|
||||
Returns a string specifying the available version of pip that will be
|
||||
installed when bootstrapping an environment.
|
||||
|
||||
@@ -39,7 +39,7 @@ Index: Python-3.14.0rc1/Doc/library/ensurepip.rst
|
||||
altinstall=False, default_pip=False, \
|
||||
verbosity=0)
|
||||
|
||||
@@ -112,6 +116,8 @@
|
||||
@@ -116,6 +120,8 @@
|
||||
If *root* is ``None``, then installation uses the default install location
|
||||
for the current environment.
|
||||
|
||||
@@ -48,7 +48,7 @@ Index: Python-3.14.0rc1/Doc/library/ensurepip.rst
|
||||
*upgrade* indicates whether or not to upgrade an existing installation
|
||||
of an earlier version of ``pip`` to the available version.
|
||||
|
||||
@@ -132,6 +138,8 @@
|
||||
@@ -136,6 +142,8 @@
|
||||
*verbosity* controls the level of output to :data:`sys.stdout` from the
|
||||
bootstrapping operation.
|
||||
|
||||
@@ -57,10 +57,10 @@ Index: Python-3.14.0rc1/Doc/library/ensurepip.rst
|
||||
.. audit-event:: ensurepip.bootstrap root ensurepip.bootstrap
|
||||
|
||||
.. note::
|
||||
Index: Python-3.14.0rc1/Lib/ensurepip/__init__.py
|
||||
Index: Python-3.14.2/Lib/ensurepip/__init__.py
|
||||
===================================================================
|
||||
--- Python-3.14.0rc1.orig/Lib/ensurepip/__init__.py 2025-07-23 10:10:18.541751619 +0200
|
||||
+++ Python-3.14.0rc1/Lib/ensurepip/__init__.py 2025-07-23 10:10:31.690818287 +0200
|
||||
--- Python-3.14.2.orig/Lib/ensurepip/__init__.py 2025-12-11 18:11:54.214805989 +0100
|
||||
+++ Python-3.14.2/Lib/ensurepip/__init__.py 2025-12-11 18:12:02.574381834 +0100
|
||||
@@ -106,27 +106,27 @@
|
||||
os.environ['PIP_CONFIG_FILE'] = os.devnull
|
||||
|
||||
@@ -123,10 +123,10 @@ Index: Python-3.14.0rc1/Lib/ensurepip/__init__.py
|
||||
upgrade=args.upgrade,
|
||||
user=args.user,
|
||||
verbosity=args.verbosity,
|
||||
Index: Python-3.14.0rc1/Lib/test/test_ensurepip.py
|
||||
Index: Python-3.14.2/Lib/test/test_ensurepip.py
|
||||
===================================================================
|
||||
--- Python-3.14.0rc1.orig/Lib/test/test_ensurepip.py 2025-07-23 10:10:19.969641992 +0200
|
||||
+++ Python-3.14.0rc1/Lib/test/test_ensurepip.py 2025-07-23 10:10:31.691217643 +0200
|
||||
--- Python-3.14.2.orig/Lib/test/test_ensurepip.py 2025-12-11 18:11:54.214805989 +0100
|
||||
+++ Python-3.14.2/Lib/test/test_ensurepip.py 2025-12-11 18:12:02.574698987 +0100
|
||||
@@ -100,6 +100,17 @@
|
||||
unittest.mock.ANY,
|
||||
)
|
||||
@@ -145,11 +145,11 @@ Index: Python-3.14.0rc1/Lib/test/test_ensurepip.py
|
||||
def test_bootstrapping_with_user(self):
|
||||
ensurepip.bootstrap(user=True)
|
||||
|
||||
Index: Python-3.14.0rc1/Makefile.pre.in
|
||||
Index: Python-3.14.2/Makefile.pre.in
|
||||
===================================================================
|
||||
--- Python-3.14.0rc1.orig/Makefile.pre.in 2025-07-23 10:10:27.325708066 +0200
|
||||
+++ Python-3.14.0rc1/Makefile.pre.in 2025-07-23 10:10:31.691716104 +0200
|
||||
@@ -2371,7 +2371,7 @@
|
||||
--- Python-3.14.2.orig/Makefile.pre.in 2025-12-11 18:11:58.776792838 +0100
|
||||
+++ Python-3.14.2/Makefile.pre.in 2025-12-11 18:12:02.575189138 +0100
|
||||
@@ -2375,7 +2375,7 @@
|
||||
install|*) ensurepip="" ;; \
|
||||
esac; \
|
||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
|
||||
@@ -158,7 +158,7 @@ Index: Python-3.14.0rc1/Makefile.pre.in
|
||||
fi
|
||||
|
||||
.PHONY: altinstall
|
||||
@@ -2382,7 +2382,7 @@
|
||||
@@ -2386,7 +2386,7 @@
|
||||
install|*) ensurepip="--altinstall" ;; \
|
||||
esac; \
|
||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
|
||||
@@ -167,9 +167,9 @@ Index: Python-3.14.0rc1/Makefile.pre.in
|
||||
fi
|
||||
|
||||
.PHONY: commoninstall
|
||||
Index: Python-3.14.0rc1/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
||||
Index: Python-3.14.2/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ Python-3.14.0rc1/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst 2025-07-23 10:10:31.692253536 +0200
|
||||
+++ Python-3.14.2/Misc/NEWS.d/next/Build/2019-12-16-17-50-42.bpo-31046.XA-Qfr.rst 2025-12-11 18:12:02.575697168 +0100
|
||||
@@ -0,0 +1 @@
|
||||
+A directory prefix can now be specified when using :mod:`ensurepip`.
|
||||
|
||||
17
configure-drop-autoconf-ver-req.patch
Normal file
17
configure-drop-autoconf-ver-req.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: Python-3.14.3/configure.ac
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/configure.ac 2026-02-03 16:32:20.000000000 +0100
|
||||
+++ Python-3.14.3/configure.ac 2026-02-13 20:23:46.066774038 +0100
|
||||
@@ -12,7 +12,7 @@
|
||||
# Set VERSION so we only need to edit in one place (i.e., here)
|
||||
m4_define([PYTHON_VERSION], [3.14])
|
||||
|
||||
-AC_PREREQ([2.72])
|
||||
+dnl AC_PREREQ([2.72])
|
||||
|
||||
AC_INIT([python],[PYTHON_VERSION],[https://github.com/python/cpython/issues/])
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Lib/test/test_compile.py | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
Index: Python-3.14.0/Lib/test/test_compile.py
|
||||
Index: Python-3.14.2/Lib/test/test_compile.py
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Lib/test/test_compile.py 2025-11-06 23:19:11.681015028 +0100
|
||||
+++ Python-3.14.0/Lib/test/test_compile.py 2025-11-06 23:22:47.971267371 +0100
|
||||
--- Python-3.14.2.orig/Lib/test/test_compile.py 2025-12-11 18:10:57.011786647 +0100
|
||||
+++ Python-3.14.2/Lib/test/test_compile.py 2025-12-11 18:12:09.732814688 +0100
|
||||
@@ -24,6 +24,9 @@
|
||||
from test.support.bytecode_helper import instructions_with_positions
|
||||
from test.support.os_helper import FakePath
|
||||
@@ -24,7 +24,7 @@ Index: Python-3.14.0/Lib/test/test_compile.py
|
||||
@support.skip_emscripten_stack_overflow()
|
||||
def test_extended_arg(self):
|
||||
repeat = 100
|
||||
@@ -709,6 +713,7 @@
|
||||
@@ -724,6 +728,7 @@
|
||||
|
||||
@support.cpython_only
|
||||
@unittest.skipIf(support.is_wasi, "exhausts limited stack on WASI")
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 4bb41b28d5bac09bccd636d8c5fefe1a462f63a7 Mon Sep 17 00:00:00 2001
|
||||
From: Alm <alon.menczer@gmail.com>
|
||||
Date: Mon, 25 Aug 2025 08:56:38 +0300
|
||||
Subject: [PATCH 1/4] Exclude .pyc files from the computed digest in the jit
|
||||
stencils
|
||||
|
||||
---
|
||||
Tools/jit/_targets.py | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
Index: Python-3.14.0rc2/Tools/jit/_targets.py
|
||||
===================================================================
|
||||
--- Python-3.14.0rc2.orig/Tools/jit/_targets.py
|
||||
+++ Python-3.14.0rc2/Tools/jit/_targets.py
|
||||
@@ -69,6 +69,9 @@ class _Target(typing.Generic[_S, _R]):
|
||||
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
|
||||
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
|
||||
for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)):
|
||||
+ # Exclude cache files from digest computation to ensure reproducible builds.
|
||||
+ if dirpath.endswith("__pycache__"):
|
||||
+ continue
|
||||
for filename in filenames:
|
||||
hasher.update(pathlib.Path(dirpath, filename).read_bytes())
|
||||
return hasher.hexdigest()
|
||||
Index: Python-3.14.0rc2/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ Python-3.14.0rc2/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Ensure reproducible builds by making JIT stencil header generation deterministic.
|
||||
@@ -4,33 +4,177 @@ Date: Tue, 23 Sep 2025 10:20:16 +0200
|
||||
Subject: [PATCH 1/2] gh-139257: Support docutils >= 0.22
|
||||
|
||||
---
|
||||
Doc/tools/extensions/pyspecific.py | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
Doc/Makefile | 2 -
|
||||
Doc/conf.py | 3 +
|
||||
Doc/tools/extensions/pyspecific.py | 68 +++++++++++++++++++++++++------------
|
||||
3 files changed, 50 insertions(+), 23 deletions(-)
|
||||
|
||||
Index: Python-3.14.0/Doc/tools/extensions/pyspecific.py
|
||||
Index: Python-3.14.3/Doc/Makefile
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Doc/tools/extensions/pyspecific.py
|
||||
+++ Python-3.14.0/Doc/tools/extensions/pyspecific.py
|
||||
@@ -25,11 +25,21 @@ from sphinx.util.docutils import SphinxD
|
||||
SOURCE_URI = 'https://github.com/python/cpython/tree/3.14/%s'
|
||||
--- Python-3.14.3.orig/Doc/Makefile 2026-02-03 16:32:20.000000000 +0100
|
||||
+++ Python-3.14.3/Doc/Makefile 2026-02-13 20:28:48.460059340 +0100
|
||||
@@ -14,7 +14,7 @@
|
||||
SOURCES =
|
||||
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
|
||||
REQUIREMENTS = requirements.txt
|
||||
-SPHINXERRORHANDLING = --fail-on-warning
|
||||
+SPHINXERRORHANDLING =
|
||||
|
||||
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = --define latex_elements.papersize=a4paper
|
||||
Index: Python-3.14.3/Doc/conf.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Doc/conf.py 2026-02-03 16:32:20.000000000 +0100
|
||||
+++ Python-3.14.3/Doc/conf.py 2026-02-13 20:21:11.034520886 +0100
|
||||
@@ -582,3 +582,6 @@
|
||||
'<meta property="og:image:width" content="200">',
|
||||
'<meta property="og:image:height" content="200">',
|
||||
)
|
||||
+
|
||||
+# Fix devhelp doc build gh#python/cpython#120150
|
||||
+master_doc = 'contents'
|
||||
Index: Python-3.14.3/Doc/tools/extensions/pyspecific.py
|
||||
===================================================================
|
||||
--- Python-3.14.3.orig/Doc/tools/extensions/pyspecific.py 2026-02-03 16:32:20.000000000 +0100
|
||||
+++ Python-3.14.3/Doc/tools/extensions/pyspecific.py 2026-02-13 17:09:31.987767795 +0100
|
||||
@@ -1,12 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
- pyspecific.py
|
||||
- ~~~~~~~~~~~~~
|
||||
+pyspecific.py
|
||||
+~~~~~~~~~~~~~
|
||||
|
||||
- Sphinx extension with Python doc-specific markup.
|
||||
+Sphinx extension with Python doc-specific markup.
|
||||
|
||||
- :copyright: 2008-2014 by Georg Brandl.
|
||||
- :license: Python license.
|
||||
+:copyright: 2008-2014 by Georg Brandl.
|
||||
+:license: Python license.
|
||||
"""
|
||||
|
||||
import re
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import directives
|
||||
+from docutils.parsers.rst.states import Body
|
||||
from docutils.utils import unescape
|
||||
from sphinx import addnodes
|
||||
from sphinx.domains.python import PyFunction, PyMethod, PyModule
|
||||
@@ -22,30 +23,48 @@
|
||||
from sphinx.util.docutils import SphinxDirective
|
||||
|
||||
# Used in conf.py and updated here by python/release-tools/run_release.py
|
||||
-SOURCE_URI = 'https://github.com/python/cpython/tree/3.14/%s'
|
||||
+SOURCE_URI = "https://github.com/python/cpython/tree/3.14/%s"
|
||||
+
|
||||
+
|
||||
+# monkey-patch reST parser to disable alphabetic and roman enumerated lists
|
||||
+def _disable_alphabetic_and_roman(text):
|
||||
+ try:
|
||||
+ # docutils >= 0.22
|
||||
+ from docutils.parsers.rst.states import InvalidRomanNumeralError
|
||||
+
|
||||
+ raise InvalidRomanNumeralError(text)
|
||||
+ except ImportError:
|
||||
+ # docutils < 0.22
|
||||
+ return None
|
||||
+
|
||||
+
|
||||
from docutils.parsers.rst.states import Body
|
||||
Body.enum.converters['loweralpha'] = \
|
||||
Body.enum.converters['upperalpha'] = \
|
||||
Body.enum.converters['lowerroman'] = \
|
||||
- Body.enum.converters['upperroman'] = lambda x: None
|
||||
+ Body.enum.converters['upperroman'] = _disable_alphabetic_and_roman
|
||||
|
||||
+Body.enum.converters["loweralpha"] = Body.enum.converters["upperalpha"] = (
|
||||
+ Body.enum.converters["lowerroman"]
|
||||
+) = Body.enum.converters["upperroman"] = _disable_alphabetic_and_roman
|
||||
+
|
||||
|
||||
class PyAwaitableMixin(object):
|
||||
def handle_signature(self, sig, signode):
|
||||
ret = super(PyAwaitableMixin, self).handle_signature(sig, signode)
|
||||
- signode.insert(0, addnodes.desc_annotation('awaitable ', 'awaitable '))
|
||||
+ signode.insert(0, addnodes.desc_annotation("awaitable ", "awaitable "))
|
||||
return ret
|
||||
|
||||
|
||||
class PyAwaitableFunction(PyAwaitableMixin, PyFunction):
|
||||
def run(self):
|
||||
- self.name = 'py:function'
|
||||
+ self.name = "py:function"
|
||||
return PyFunction.run(self)
|
||||
|
||||
|
||||
class PyAwaitableMethod(PyAwaitableMixin, PyMethod):
|
||||
def run(self):
|
||||
- self.name = 'py:method'
|
||||
+ self.name = "py:method"
|
||||
return PyMethod.run(self)
|
||||
|
||||
|
||||
# Support for documenting Opcodes
|
||||
|
||||
-opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)(?:\s*\((.*)\))?')
|
||||
+opcode_sig_re = re.compile(r"(\w+(?:\+\d)?)(?:\s*\((.*)\))?")
|
||||
|
||||
|
||||
def parse_opcode_signature(env, sig, signode):
|
||||
@@ -64,7 +83,7 @@
|
||||
|
||||
# Support for documenting pdb commands
|
||||
|
||||
-pdbcmd_sig_re = re.compile(r'([a-z()!]+)\s*(.*)')
|
||||
+pdbcmd_sig_re = re.compile(r"([a-z()!]+)\s*(.*)")
|
||||
|
||||
# later...
|
||||
# pdbargs_tokens_re = re.compile(r'''[a-zA-Z]+ | # identifiers
|
||||
@@ -80,16 +99,16 @@
|
||||
if m is None:
|
||||
raise ValueError
|
||||
name, args = m.groups()
|
||||
- fullname = name.replace('(', '').replace(')', '')
|
||||
+ fullname = name.replace("(", "").replace(")", "")
|
||||
signode += addnodes.desc_name(name, name)
|
||||
if args:
|
||||
- signode += addnodes.desc_addname(' '+args, ' '+args)
|
||||
+ signode += addnodes.desc_addname(" " + args, " " + args)
|
||||
return fullname
|
||||
|
||||
|
||||
def parse_monitoring_event(env, sig, signode):
|
||||
"""Transform a monitoring event signature into RST nodes."""
|
||||
- signode += addnodes.desc_addname('sys.monitoring.events.', 'sys.monitoring.events.')
|
||||
+ signode += addnodes.desc_addname("sys.monitoring.events.", "sys.monitoring.events.")
|
||||
signode += addnodes.desc_name(sig, sig)
|
||||
return sig
|
||||
|
||||
@@ -102,7 +121,7 @@
|
||||
As such, we link this to ``env-check-consistency``, even though it has
|
||||
nothing to do with the environment consistency check.
|
||||
"""
|
||||
- if app.builder.name != 'gettext':
|
||||
+ if app.builder.name != "gettext":
|
||||
return
|
||||
|
||||
# allow translating deprecated index entries
|
||||
@@ -119,10 +138,15 @@
|
||||
|
||||
|
||||
def setup(app):
|
||||
- app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature)
|
||||
- app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command)
|
||||
- app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event)
|
||||
- app.add_directive_to_domain('py', 'awaitablefunction', PyAwaitableFunction)
|
||||
- app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod)
|
||||
- app.connect('env-check-consistency', patch_pairindextypes)
|
||||
- return {'version': '1.0', 'parallel_read_safe': True}
|
||||
+ app.add_object_type("opcode", "opcode", "%s (opcode)", parse_opcode_signature)
|
||||
+ app.add_object_type("pdbcommand", "pdbcmd", "%s (pdb command)", parse_pdb_command)
|
||||
+ app.add_object_type(
|
||||
+ "monitoring-event",
|
||||
+ "monitoring-event",
|
||||
+ "%s (monitoring event)",
|
||||
+ parse_monitoring_event,
|
||||
+ )
|
||||
+ app.add_directive_to_domain("py", "awaitablefunction", PyAwaitableFunction)
|
||||
+ app.add_directive_to_domain("py", "awaitablemethod", PyAwaitableMethod)
|
||||
+ app.connect("env-check-consistency", patch_pairindextypes)
|
||||
+ return {"version": "1.0", "parallel_read_safe": True}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Makefile.pre.in | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
Index: Python-3.14.0/Makefile.pre.in
|
||||
Index: Python-3.14.2/Makefile.pre.in
|
||||
===================================================================
|
||||
--- Python-3.14.0.orig/Makefile.pre.in 2025-10-07 11:34:52.000000000 +0200
|
||||
+++ Python-3.14.0/Makefile.pre.in 2025-11-06 23:19:25.434995608 +0100
|
||||
@@ -1910,6 +1910,11 @@
|
||||
--- Python-3.14.2.orig/Makefile.pre.in 2025-12-11 18:11:54.290805770 +0100
|
||||
+++ Python-3.14.2/Makefile.pre.in 2025-12-11 18:11:58.776792838 +0100
|
||||
@@ -1914,6 +1914,11 @@
|
||||
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
|
||||
-o $@ $(srcdir)/Modules/getbuildinfo.c
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
addFilter("pem-certificate.*/usr/lib.*/python.*/test/*.pem")
|
||||
addFilter("devel-file-in-non-devel-package.*/usr/lib.*/python.*/tests/*.c")
|
||||
addFilter("devel-file-in-non-devel-package.*/usr/lib.*/python.*/test/*.cpp")
|
||||
addFilter("python-bytecode-inconsistent-mtime.*/usr/lib.*/python.*/*.pyc")
|
||||
|
||||
1008
python314.changes
1008
python314.changes
File diff suppressed because it is too large
Load Diff
@@ -124,7 +124,7 @@
|
||||
# %%define tarversion %%{version}
|
||||
# %%endif
|
||||
# We don't process beta signs well
|
||||
%define folderversion 3.14.0
|
||||
%define folderversion 3.14.3
|
||||
%define sitedir %{_libdir}/python%{python_version}
|
||||
# three possible ABI kinds: m - pymalloc, d - debug build; see PEP 3149
|
||||
%define abi_kind %{nil}
|
||||
@@ -162,7 +162,7 @@
|
||||
# _md5.cpython-38m-x86_64-linux-gnu.so
|
||||
%define dynlib() %{sitedir}/lib-dynload/%{1}.cpython-%{abi_tag}-%{archname}-%{_os}%{?_gnu}%{?armsuffix}.so
|
||||
Name: %{python_pkg_name}%{psuffix}
|
||||
Version: 3.14.0
|
||||
Version: 3.14.3
|
||||
%define tarversion %{version}
|
||||
%define tarname Python-%{tarversion}
|
||||
Release: 0
|
||||
@@ -203,6 +203,9 @@ Patch02: F00251-change-user-install-location.patch
|
||||
Patch03: python-3.3.0b1-localpath.patch
|
||||
# replace DATE, TIME and COMPILER by fixed definitions to aid reproducible builds
|
||||
Patch04: python-3.3.0b1-fix_date_time_compiler.patch
|
||||
# PATCH-FIX-OPENSUSE configure-drop-autoconf-ver-req.patch mcepl@suse.com
|
||||
# don't require minimal version of Autoconf
|
||||
Patch05: configure-drop-autoconf-ver-req.patch
|
||||
# PATCH-FEATURE-UPSTREAM bpo-31046_ensurepip_honours_prefix.patch bpo#31046 mcepl@suse.com
|
||||
# ensurepip should honour the value of $(prefix)
|
||||
Patch07: bpo-31046_ensurepip_honours_prefix.patch
|
||||
@@ -220,17 +223,22 @@ Patch40: fix-test-recursion-limit-15.6.patch
|
||||
# PATCH-FIX-UPSTREAM bsc1243155-sphinx-non-determinism.patch bsc#1243155 mcepl@suse.com
|
||||
# Doc: Generate ids for audit_events using docname
|
||||
Patch41: bsc1243155-sphinx-non-determinism.patch
|
||||
# PATCH-FIX-UPSTREAM gh138131-exclude-pycache-from-digest.patch bsc#1244680 daniel.garcia@suse.com
|
||||
Patch44: gh138131-exclude-pycache-from-digest.patch
|
||||
# PATCH-FIX-OPENSUSE gh139257-Support-docutils-0.22.patch gh#python/cpython#139257 daniel.garcia@suse.com
|
||||
Patch45: gh139257-Support-docutils-0.22.patch
|
||||
# PATCH-FIX-UPSTREAM CVE-2025-8291-consistency-zip64.patch bsc#1251305 mcepl@suse.com
|
||||
# Check consistency of the zip64 end of central directory record
|
||||
Patch46: CVE-2025-8291-consistency-zip64.patch
|
||||
# PATCH-FIX-UPSTREAM CVE-2025-6075-expandvars-perf-degrad.patch bsc#1252974 mcepl@suse.com
|
||||
# Avoid potential quadratic complexity vulnerabilities in path modules
|
||||
Patch47: CVE-2025-6075-expandvars-perf-degrad.patch
|
||||
#### Python 3.14 DEVELOPMENT PATCHES
|
||||
# PATCH-FIX-UPSTREAM CVE-2024-6923-follow-up-EOL-email-headers.patch bsc#1257181 mcepl@suse.com
|
||||
# Encode newlines in headers when using ByteGenerator
|
||||
# patch from gh#python/cpython#144125
|
||||
Patch46: CVE-2024-6923-follow-up-EOL-email-headers.patch
|
||||
# PATCH-FIX-UPSTREAM CVE-2025-12781-b64decode-alt-chars.patch bsc#1257108 mcepl@suse.com
|
||||
# Fix decoding with non-standard Base64 alphabet gh#python/cpython#125346
|
||||
Patch49: CVE-2025-12781-b64decode-alt-chars.patch
|
||||
# PATCH-FIX-UPSTREAM CVE-2025-15366-imap-ctrl-chars.patch bsc#1257044 mcepl@suse.com
|
||||
# Reject control characters in wsgiref.headers.Headers
|
||||
Patch50: CVE-2025-15366-imap-ctrl-chars.patch
|
||||
# PATCH-FIX-UPSTREAM CVE-2025-15367-poplib-ctrl-chars.patch bsc#1257041 mcepl@suse.com
|
||||
# Reject control characters in poplib
|
||||
Patch51: CVE-2025-15367-poplib-ctrl-chars.patch
|
||||
#### Python 3.14 END OF PATCHES
|
||||
BuildRequires: autoconf-archive
|
||||
BuildRequires: automake
|
||||
BuildRequires: fdupes
|
||||
@@ -515,12 +523,6 @@ other applications.
|
||||
%prep
|
||||
%autosetup -p1 -n %{tarname}
|
||||
|
||||
# Fix devhelp doc build gh#python/cpython#120150
|
||||
echo "master_doc = 'contents'" >> Doc/conf.py
|
||||
|
||||
# drop Autoconf version requirement
|
||||
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac
|
||||
|
||||
%if %{primary_interpreter}
|
||||
# fix shebangs - convert /usr/local/bin/python and /usr/bin/env/python to /usr/bin/python3
|
||||
for dir in Lib Tools; do
|
||||
@@ -540,7 +542,7 @@ done
|
||||
sed -i -e '/Breakpoint 3 at ...pdb.py:97/s/97/96/' Lib/test/test_pdb.py
|
||||
%endif
|
||||
|
||||
# Cannot remove it because of gh#python/cpython#92875
|
||||
# Removing vendored expat gh#python/cpython#92875
|
||||
rm -r Modules/expat
|
||||
|
||||
# drop duplicate README from site-packages
|
||||
@@ -549,9 +551,6 @@ rm Lib/site-packages/README.txt
|
||||
# Add vendored bluez-devel files
|
||||
tar xvf %{SOURCE21}
|
||||
|
||||
# Don't fail on warnings when building documentation
|
||||
sed -i -e '/^SPHINXERRORHANDLING/s/--fail-on-warning//' Doc/Makefile
|
||||
|
||||
%build
|
||||
export SUSE_VERSION="0%{?suse_version}"
|
||||
export SLE_VERSION="0%{?sle_version}"
|
||||
|
||||
Reference in New Issue
Block a user