Sync from SUSE:SLFO:Main python-Twisted revision bdf37c07fa93f26f61a8cd5c9954b219

This commit is contained in:
2025-03-28 16:34:32 +01:00
parent 0356f476e0
commit 8929874bcf
8 changed files with 93 additions and 92 deletions

View File

@@ -1,60 +0,0 @@
From 185ff4b3f2e402e6a3c450d826223c79b53af333 Mon Sep 17 00:00:00 2001
From: Itamar Turner-Trauring <itamar@pythonspeed.com>
Date: Tue, 10 Sep 2024 14:04:21 -0400
Subject: [PATCH 1/3] Fix (or workaround?) bug that happens in 3.13 where last
frame of traceback is omitted.
---
src/twisted/conch/manhole.py | 6 +++++-
src/twisted/conch/newsfragments/12313.misc | 0
2 files changed, 5 insertions(+), 1 deletion(-)
create mode 100644 src/twisted/conch/newsfragments/12313.misc
diff --git a/src/twisted/conch/manhole.py b/src/twisted/conch/manhole.py
index f552af5bbdc..1fce66a8cd4 100644
--- a/src/twisted/conch/manhole.py
+++ b/src/twisted/conch/manhole.py
@@ -124,7 +124,11 @@ def excepthook(
"""
Format exception tracebacks and write them to the output handler.
"""
- lines = format_exception(excType, excValue, excTraceback.tb_next)
+ if sys.version_info[:2] < (3, 13):
+ traceback = excTraceback.tb_next
+ else:
+ traceback = excTraceback
+ lines = format_exception(excType, excValue, traceback)
self.write("".join(lines))
def displayhook(self, obj):
diff --git a/src/twisted/conch/newsfragments/12313.misc b/src/twisted/conch/newsfragments/12313.misc
new file mode 100644
index 00000000000..e69de29bb2d
From 2a73df859a8f9f61bc9de535eb39878ab10200e6 Mon Sep 17 00:00:00 2001
From: Itamar Turner-Trauring <itamar@pythonspeed.com>
Date: Mon, 16 Sep 2024 10:51:39 -0400
Subject: [PATCH 3/3] Check based on symptoms, rather than version.
---
src/twisted/conch/manhole.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/twisted/conch/manhole.py b/src/twisted/conch/manhole.py
index 1fce66a8cd4..670ac0480ec 100644
--- a/src/twisted/conch/manhole.py
+++ b/src/twisted/conch/manhole.py
@@ -124,9 +124,12 @@ def excepthook(
"""
Format exception tracebacks and write them to the output handler.
"""
- if sys.version_info[:2] < (3, 13):
+ code_obj = excTraceback.tb_frame.f_code
+ if code_obj.co_filename == code.__file__ and code_obj.co_name == "runcode":
traceback = excTraceback.tb_next
else:
+ # Workaround for https://github.com/python/cpython/issues/122478,
+ # present e.g. in Python 3.12.6:
traceback = excTraceback
lines = format_exception(excType, excValue, traceback)
self.write("".join(lines))

View File

@@ -9,10 +9,10 @@ Subject: [PATCH] delegate to stdlib parse qs
2 files changed, 2 insertions(+), 28 deletions(-)
create mode 100644 src/twisted/web/newsfragments/10096.bugfix
diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
index 18710f51dc..f0fea06b5d 100644
--- a/src/twisted/web/http.py
+++ b/src/twisted/web/http.py
Index: twisted-24.10.0/src/twisted/web/http.py
===================================================================
--- twisted-24.10.0.orig/src/twisted/web/http.py
+++ twisted-24.10.0/src/twisted/web/http.py
@@ -125,6 +125,7 @@ from urllib.parse import (
ParseResultBytes,
unquote_to_bytes as unquote,
@@ -21,7 +21,7 @@ index 18710f51dc..f0fea06b5d 100644
)
from zope.interface import Attribute, Interface, implementer, provider
@@ -363,34 +364,6 @@ def urlparse(url):
@@ -371,34 +372,6 @@ def urlparse(url):
return ParseResultBytes(scheme, netloc, path, params, query, fragment)
@@ -56,13 +56,9 @@ index 18710f51dc..f0fea06b5d 100644
def datetimeToString(msSinceEpoch=None):
"""
Convert seconds since epoch to HTTP datetime string.
diff --git a/src/twisted/web/newsfragments/10096.bugfix b/src/twisted/web/newsfragments/10096.bugfix
new file mode 100644
index 0000000000..8f5b4759cb
Index: twisted-24.10.0/src/twisted/web/newsfragments/10096.bugfix
===================================================================
--- /dev/null
+++ b/src/twisted/web/newsfragments/10096.bugfix
+++ twisted-24.10.0/src/twisted/web/newsfragments/10096.bugfix
@@ -0,0 +1 @@
+delegate to urllib.parse:parse_qs in twisted.web.http:parse_qs to avoid CVE-2021-23336 and the associated CI failures
--
2.46.0

View File

@@ -2,10 +2,10 @@
src/twisted/conch/test/test_keys.py | 3 +++
1 file changed, 3 insertions(+)
Index: twisted-24.3.0/src/twisted/conch/test/test_keys.py
Index: twisted-24.10.0/src/twisted/conch/test/test_keys.py
===================================================================
--- twisted-24.3.0.orig/src/twisted/conch/test/test_keys.py
+++ twisted-24.3.0/src/twisted/conch/test/test_keys.py
--- twisted-24.10.0.orig/src/twisted/conch/test/test_keys.py
+++ twisted-24.10.0/src/twisted/conch/test/test_keys.py
@@ -15,6 +15,7 @@ from twisted.python import randbytes
from twisted.python.filepath import FilePath
from twisted.python.reflect import requireModule
@@ -14,9 +14,9 @@ Index: twisted-24.3.0/src/twisted/conch/test/test_keys.py
cryptography = requireModule("cryptography")
if cryptography is None:
@@ -250,6 +251,8 @@ class KeyTests(unittest.TestCase):
for k, v in data.items():
self.assertEqual(privateKey.data()[k], v)
@@ -278,6 +279,8 @@ class KeyTests(unittest.TestCase):
publicKey = keys.Key.fromString(public)
self.assertTrue(publicKey._sk)
+ @pyunit.skip('Upstream ticket https://twistedmatrix.com/trac/ticket/9665' +
+ ' has still not been resolved.')

View File

@@ -1,7 +1,73 @@
-------------------------------------------------------------------
Tue Oct 29 18:00:39 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 24.10.0:
* Python 3.13 is now supported.
* twisted.internet.defer.succeed() is significantly faster, and
awaiting Deferred has also been sped up.
* twisted.python.failure.Failure creation no longer records the
place where it was created. This reduces creation time by 60%
at least, thereby speeding up Deferred error handling.
* twisted.internet.defer.Deferred no longer removes the
traceback object from Failures. This may result in more
objects staying in memory if you don't clean up failed
Deferreds, but it speeds up error handling and enables
improvements to traceback reporting.
* twisted.internet.defer APIs are 2%-4% faster in many cases.
* twisted.internet.defer.Deferred runs callbacks with chained
Deferreds a little faster.
* The reactor now will use a little less CPU when events have
been scheduled with callLater().
* Creation of twisted.python.failure.Failure is now faster.
* Fixed unreleased regression caused by PR 12109.
* twisted.logger.eventAsText can now format the output having
types/classes as input. This was a regression introduced in
Twisted 24.3.0.
* twisted.internet.endpoints.clientFromString for TLS endpoints
with "bindAddress=" no longer crashes during connect.
twisted.internet.endpoints.HostnameEndpoint() no longer
crashes when given a bindAddress= argument that is just a
string, and that argument now accepts either address strings
or (address, port) tuples.
* The URLs from README and pyproject.toml were updated.
* #11236, #12060, #12062, #12099, #12219, #12290, #12296,
#12305, #12329, #12331, #12339
* twisted.conch.ssh.keys.Key can now load public blob keys of
type sk-ssh-ed25519@openssh.com and sk-ecdsa-
sha2-nistp256@openssh.com.
* twisted.conch tests no longer rely on OpenSSH supporting DSA
keys, fixing compatibility with OpenSSH >= 9.8.
* twisted.conch.ssh.SSHCiphers no longer supports the
cast128-ctr, cast128-cbc, blowfish-ctr, and blowfish-cbc
ciphers. The Blowfish and CAST5 ciphers were removed as they
were deprecated by the Python cryptography library.
* #12313
* The twisted.web HTTP server and client now reject HTTP header
names containing whitespace or other invalid characters by
raising twisted.web.http_headers.InvalidHeaderName, improving
compliance with RFC 9110. As a side effect, the server is
slightly faster.
* twisted.web.client and twisted.web.server now disable the
Nagle algorithm (enable TCP_NODELAY), reducing the latency of
small HTTP queries.
* twisted.web.server is 1-2% faster in some cases.
* twisted.web's HTTP/1.1 server now rejects header values
containing a NUL byte with a 400 error, in compliance with
RFC 9110.
* twisted.internet.address no longer raises DeprecationWarning
when used with attrs>=24.1.0.
* twisted.web's HTTP/1.1 server now accepts '&' within tokens
(methods, header field names, etc.), in compliance with RFC
9110.
* #9743, #12276
* Trial's -j flag now accepts an auto keyword to spawn a number
of workers based on the available CPUs.
- drop 12313-fix-test_manhole.patch: upstream
-------------------------------------------------------------------
Wed Sep 25 06:38:11 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add upstream patch 12313-fix-test_manhole.patch to fix test failure
- Add upstream patch 12313-fix-test_manhole.patch to fix test failure
with latest python312
-------------------------------------------------------------------

View File

@@ -27,7 +27,7 @@
%{?sle15_python_module_pythons}
Name: python-Twisted%{psuffix}
Version: 24.7.0
Version: 24.10.0
Release: 0
Summary: An asynchronous networking framework written in Python
License: MIT
@@ -45,8 +45,6 @@ Patch3: 1521_delegate_parseqs_stdlib_bpo42967.patch
Patch5: no-cython_test_exception_raiser.patch
# PATCH-FIX-OPENSUSE remove-dependency-version-upper-bounds.patch boo#1190036 -- run with h2 >= 4.0.0 and priority >= 2.0
Patch6: remove-dependency-version-upper-bounds.patch
# PATCH-FIX-UPSTREAM https://github.com/twisted/twisted/pull/12314 12313 Fix test_manhole.py on Python 3.13rc2
Patch7: 12313-fix-test_manhole.patch
BuildRequires: %{python_module hatch-fancy-pypi-readme}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module incremental >= 24.7.0}
@@ -72,9 +70,10 @@ Requires: python-Twisted-tls = %{version}
%if %{with test}
BuildRequires: %{python_module Twisted-all_non_platform = %{version}}
BuildRequires: %{python_module Twisted-conch_nacl = %{version}}
BuildRequires: %{python_module httpx}
BuildRequires: %{python_module hypothesis}
# declared nowhere but required to pass 8 tests with timezone checks
BuildRequires: %{python_module pytz}
BuildRequires: %{python_module hypothesis}
%endif
BuildArch: noarch
%python_subpackages

View File

@@ -1,14 +1,14 @@
Index: twisted-23.10.0/pyproject.toml
Index: twisted-24.10.0/pyproject.toml
===================================================================
--- twisted-23.10.0.orig/pyproject.toml
+++ twisted-23.10.0/pyproject.toml
@@ -95,8 +95,8 @@ serial = [
--- twisted-24.10.0.orig/pyproject.toml
+++ twisted-24.10.0/pyproject.toml
@@ -97,8 +97,8 @@ serial = [
]
http2 = [
- "h2 >= 3.0, < 5.0",
- "h2 >= 3.2, < 5.0",
- "priority >= 1.1.0, < 2.0",
+ "h2 >= 3.0",
+ "h2 >= 3.2",
+ "priority >= 1.1.0",
]

BIN
twisted-24.10.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
twisted-24.7.0.tar.gz (Stored with Git LFS)

Binary file not shown.