15
0

Accepting request 1184937 from devel:languages:python

- update to 24.3.0:
  * twisted.logger.formatEvent now honors dotted method names,
    not just flat function names, in format strings, as it has
    long been explicitly documented to do.  So, you will now get
    the expected result from formatEvent("here's the result of
    calling a method at log-format time: {obj.method()}",
    obj=...)
  * twisted.web.http.HTTPChannel now ignores the trailer headers
    provided in the last chunk of a chunked encoded response,
    rather than raising an exception.
  * twisted.protocols.tls.BufferingTLSTransport, used by default
    by twisted.protocols.tls.TLSMemoryBIOFactory, was refactored
    for improved performance when doing a high number of small
    writes.
  * twisted.python.failure.Failure now throws exception for
    generators without triggering a deprecation warnings on
    Python 3.12.
  * twisted.internet.process.Process, used by
    reactor.spawnProcess, now copies the parent environment when
    the env=None argument is passed on Posix systems and
    os.posix_spawnp is used internally.
  * twisted.internet.defer.inlineCallbacks.returnValue's stack
    introspection was adjusted for the latest PyPy 7.3.14
    release, allowing legacy @inlineCallbacks to run on new PyPY
    versions.
  * twisted.trial.reporter.TestRun.startTest() is no longer
    called for tests with skip annotation or skip attribute for
    Python 3.12.1 or newer. This is the result of upstream Python
    gh-106584 change. The behavior is not change in 3.12.0 or
    older.

OBS-URL: https://build.opensuse.org/request/show/1184937
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Twisted?expand=0&rev=69
This commit is contained in:
2024-07-03 18:29:45 +00:00
committed by Git OBS Bridge
10 changed files with 81 additions and 167 deletions

View File

@@ -10,11 +10,11 @@ Subject: [PATCH 1/2] delegate to stdlib parse qs
3 files changed, 4 insertions(+), 28 deletions(-)
create mode 100644 src/twisted/web/newsfragments/10096.bugfix
Index: Twisted-22.1.0/src/twisted/web/http.py
Index: twisted-24.3.0/src/twisted/web/http.py
===================================================================
--- Twisted-22.1.0.orig/src/twisted/web/http.py
+++ Twisted-22.1.0/src/twisted/web/http.py
@@ -113,6 +113,7 @@ from urllib.parse import (
--- twisted-24.3.0.orig/src/twisted/web/http.py
+++ twisted-24.3.0/src/twisted/web/http.py
@@ -115,6 +115,7 @@ from urllib.parse import (
ParseResultBytes,
unquote_to_bytes as unquote,
urlparse as _urlparse,
@@ -22,7 +22,7 @@ Index: Twisted-22.1.0/src/twisted/web/http.py
)
from zope.interface import Attribute, Interface, implementer, provider
@@ -263,31 +264,6 @@ def urlparse(url):
@@ -288,34 +289,6 @@ def urlparse(url):
return ParseResultBytes(scheme, netloc, path, params, query, fragment)
@@ -30,6 +30,9 @@ Index: Twisted-22.1.0/src/twisted/web/http.py
- """
- Like C{cgi.parse_qs}, but with support for parsing byte strings on Python 3.
-
- This was created to help with Python 2 to Python 3 migration.
- Consider using L{urllib.parse.parse_qs}.
-
- @type qs: C{bytes}
- """
- d = {}
@@ -54,16 +57,16 @@ Index: Twisted-22.1.0/src/twisted/web/http.py
def datetimeToString(msSinceEpoch=None):
"""
Convert seconds since epoch to HTTP datetime string.
Index: Twisted-22.1.0/src/twisted/web/newsfragments/10096.bugfix
Index: twisted-24.3.0/src/twisted/web/newsfragments/10096.bugfix
===================================================================
--- /dev/null
+++ Twisted-22.1.0/src/twisted/web/newsfragments/10096.bugfix
+++ twisted-24.3.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
Index: Twisted-22.1.0/src/twisted/web/server.py
Index: twisted-24.3.0/src/twisted/web/server.py
===================================================================
--- Twisted-22.1.0.orig/src/twisted/web/server.py
+++ Twisted-22.1.0/src/twisted/web/server.py
--- twisted-24.3.0.orig/src/twisted/web/server.py
+++ twisted-24.3.0/src/twisted/web/server.py
@@ -21,7 +21,7 @@ import zlib
from binascii import hexlify
from html import escape
@@ -81,7 +84,7 @@ Index: Twisted-22.1.0/src/twisted/web/server.py
NOT_DONE_YET = 1
@@ -211,7 +210,7 @@ class Request(Copyable, http.Request, co
@@ -210,7 +209,7 @@ class Request(Copyable, http.Request, co
# Resource Identification
self.prepath = []

View File

@@ -2,16 +2,16 @@
src/twisted/test/test_failure.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: twisted-23.10.0/src/twisted/test/test_failure.py
Index: twisted-24.3.0/src/twisted/test/test_failure.py
===================================================================
--- twisted-23.10.0.orig/src/twisted/test/test_failure.py
+++ twisted-23.10.0/src/twisted/test/test_failure.py
--- twisted-24.3.0.orig/src/twisted/test/test_failure.py
+++ twisted-24.3.0/src/twisted/test/test_failure.py
@@ -18,7 +18,8 @@ from types import TracebackType
from typing import Any, Generator
from unittest import skipIf
-from cython_test_exception_raiser import raiser # type: ignore[import]
+# from cython_test_exception_raiser import raiser # type: ignore[import]
-from cython_test_exception_raiser import raiser
+# from cython_test_exception_raiser import raiser
+raiser = None
from twisted.python import failure, reflect

View File

@@ -2,10 +2,10 @@
src/twisted/conch/test/test_keys.py | 3 +++
1 file changed, 3 insertions(+)
Index: Twisted-22.10.0/src/twisted/conch/test/test_keys.py
Index: twisted-24.3.0/src/twisted/conch/test/test_keys.py
===================================================================
--- Twisted-22.10.0.orig/src/twisted/conch/test/test_keys.py
+++ Twisted-22.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
@@ -15,6 +15,7 @@ from twisted.python import randbytes
from twisted.python.filepath import FilePath
from twisted.python.reflect import requireModule
@@ -14,7 +14,7 @@ Index: Twisted-22.10.0/src/twisted/conch/test/test_keys.py
cryptography = requireModule("cryptography")
if cryptography is None:
@@ -259,6 +260,8 @@ class KeyTests(unittest.TestCase):
@@ -250,6 +251,8 @@ class KeyTests(unittest.TestCase):
for k, v in data.items():
self.assertEqual(privateKey.data()[k], v)

View File

@@ -1,3 +1,39 @@
-------------------------------------------------------------------
Tue Jul 2 19:43:29 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 24.3.0:
* twisted.logger.formatEvent now honors dotted method names,
not just flat function names, in format strings, as it has
long been explicitly documented to do. So, you will now get
the expected result from formatEvent("here's the result of
calling a method at log-format time: {obj.method()}",
obj=...)
* twisted.web.http.HTTPChannel now ignores the trailer headers
provided in the last chunk of a chunked encoded response,
rather than raising an exception.
* twisted.protocols.tls.BufferingTLSTransport, used by default
by twisted.protocols.tls.TLSMemoryBIOFactory, was refactored
for improved performance when doing a high number of small
writes.
* twisted.python.failure.Failure now throws exception for
generators without triggering a deprecation warnings on
Python 3.12.
* twisted.internet.process.Process, used by
reactor.spawnProcess, now copies the parent environment when
the env=None argument is passed on Posix systems and
os.posix_spawnp is used internally.
* twisted.internet.defer.inlineCallbacks.returnValue's stack
introspection was adjusted for the latest PyPy 7.3.14
release, allowing legacy @inlineCallbacks to run on new PyPY
versions.
* twisted.trial.reporter.TestRun.startTest() is no longer
called for tests with skip annotation or skip attribute for
Python 3.12.1 or newer. This is the result of upstream Python
gh-106584 change. The behavior is not change in 3.12.0 or
older.
- drop twisted-pr12054-testinvokationpy3.12.1.patch,
stop-using-3-arg-throw.patch (upstream)
-------------------------------------------------------------------
Thu Feb 1 08:33:49 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
@@ -21,15 +57,15 @@ Thu Nov 23 08:28:43 UTC 2023 - Markéta Machová <mmachova@suse.com>
* twisted.internet.defer.race has been added as a way to get the first available result from a list of Deferreds. (#11817)
* The CI suite was updated to execute the tests using a Python 3.12 pre-release (#11857)
* PyAsn1 has been removed as a conch dependency.
* Due to changes in the way raw private key byte serialization are handled in Cryptography, and widespread support
* Due to changes in the way raw private key byte serialization are handled in Cryptography, and widespread support
for Ed25519 in current versions of OpenSSL, we no longer support PyNaCl as a fallback for Ed25519 keys in Conch. (#11871)
* In Twisted 16.3.0, we changed twisted.web to stop dispatching HTTP/1.1 pipelined requests to application code.
There was a bug in this change which still allowed clients which could send multiple full HTTP requests in a single TCP segment
to trigger asynchronous processing of later requests, which could lead to out-of-order responses. This has now been corrected
and twisted.web should never process a pipelined request over HTTP/1.1 until the previous request has fully completed.
* In Twisted 16.3.0, we changed twisted.web to stop dispatching HTTP/1.1 pipelined requests to application code.
There was a bug in this change which still allowed clients which could send multiple full HTTP requests in a single TCP segment
to trigger asynchronous processing of later requests, which could lead to out-of-order responses. This has now been corrected
and twisted.web should never process a pipelined request over HTTP/1.1 until the previous request has fully completed.
(CVE-2023-46137, GHSA-cq7q-gv5w-rwx2) (#11976)
* Drop support for Python 3.7. Remove twisted[contextvars] extra (contextvars are always available in Python 3.7+) (#11913)
* When using CPython, functions wrapped by twisted.internet.defer.inlineCallbacks can have their arguments and return values
* When using CPython, functions wrapped by twisted.internet.defer.inlineCallbacks can have their arguments and return values
freed immediately after completion (due to there no longer being circular references). (#11885)
- Delete merged patches:
* regenerate-cert-to-work-with-latest-service-identity.patch
@@ -71,7 +107,7 @@ Thu Apr 13 22:45:37 UTC 2023 - Matej Cepl <mcepl@suse.com>
Wed Feb 8 08:19:43 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-new-glibc.patch:
* Support new glibc changes.
* Support new glibc changes.
-------------------------------------------------------------------
Tue Jan 10 17:43:37 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
@@ -115,7 +151,7 @@ Tue Nov 1 05:46:14 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
+ Implement twisted.python.failure._Code.co_positions for compatibility
with Python 3.11.
+ twisted.pair.tuntap._TUNSETIFF and ._TUNGETIFF values are now correct
parisc, powerpc and sparc architectures.
parisc, powerpc and sparc architectures.
+ twisted.web.vhost.NameVirtualHost will no longerreturn a NoResource
error. (bsc#1204781, CVE-2022-39348)
+ drops CVE-2022-39348-do-not-echo-host-header.patch in older dists
@@ -181,7 +217,7 @@ Tue Jun 21 18:08:20 UTC 2022 - Ben Greiner <code@bnavigator.de>
Wed May 4 06:39:10 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Stop removing test directories, it also removes a public module.
(bsc#1198852, bsc#1198854, bsc#1198855)
(bsc#1198852, bsc#1198854, bsc#1198855)
-------------------------------------------------------------------
Thu Apr 7 02:31:24 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
@@ -209,7 +245,7 @@ Thu Apr 7 02:31:24 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
Thu Mar 24 12:40:28 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add patch skip-namespacewithwhitespace.patch:
* Skip a failing test with Expat 2.4.5.
* Skip a failing test with Expat 2.4.5.
-------------------------------------------------------------------
Wed Feb 23 00:30:47 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
@@ -299,7 +335,7 @@ Wed Feb 9 23:29:53 UTC 2022 - Marcus Rueckert <mrueckert@suse.de>
Thu Jan 6 04:48:46 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch currentThread-deprecated.patch:
* Do not call a deprecated method which causes reactor startup to abort.
* Do not call a deprecated method which causes reactor startup to abort.
-------------------------------------------------------------------
Fri Dec 10 17:04:31 UTC 2021 - Ben Greiner <code@bnavigator.de>
@@ -350,7 +386,7 @@ Sat Jul 31 04:27:55 UTC 2021 - Matej Cepl <mcepl@suse.com>
-------------------------------------------------------------------
Mon May 17 10:15:13 UTC 2021 - Dirk Müller <dmueller@suse.com>
- add incremental-21.patch: support newer incremental versions
- add incremental-21.patch: support newer incremental versions
-------------------------------------------------------------------
Wed Mar 10 06:11:42 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
@@ -450,7 +486,7 @@ Thu Feb 11 15:49:07 UTC 2021 - Pedro Monreal <pmonreal@suse.com>
-------------------------------------------------------------------
Fri Dec 11 00:02:02 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- Add twisted-pr1369-remove-pyopenssl-npn.patch to support
- Add twisted-pr1369-remove-pyopenssl-npn.patch to support
pyOpenSSL 20
- Add twisted-pr1487-increase-ffdh-keysize.patch to support
crpytography 3.3
@@ -473,7 +509,7 @@ Thu May 28 12:43:51 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 20.3.0
* drop Python 2
* twisted.news is deprecated.
* twisted.conch.ssh now supports the curve25519-sha256 key exchange
* twisted.conch.ssh now supports the curve25519-sha256 key exchange
algorithm (requires OpenSSL >= 1.1.0).
* many bugfixes and other miscelaneous fixes
- Fixed update-alternatives mechanism

View File

@@ -25,10 +25,9 @@
%define psuffix %{nil}
%endif
%define skip_python2 1
%{?sle15_python_module_pythons}
Name: python-Twisted%{psuffix}
Version: 23.10.0
Version: 24.3.0
Release: 0
Summary: An asynchronous networking framework written in Python
License: MIT
@@ -42,14 +41,10 @@ Patch2: no-test_successResultOfWithFailureHasTraceback.patch
# PATCH-FIX-UPSTREAM 1521_delegate_parseqs_stdlib_bpo42967.patch https://twistedmatrix.com/trac/ticket/10096 mcepl@suse.com
# overcome incompatibility with the solution for bpo#42967.
Patch3: 1521_delegate_parseqs_stdlib_bpo42967.patch
# PATCH-FIX-UPSTREAM twisted-pr12054-testinvokationpy3.12.1.patch gh#twisted/twisted#12054 fixes gh#twisted/twisted#12052
Patch4: twisted-pr12054-testinvokationpy3.12.1.patch
# PATCH-FIX-OPENSUSE We don't want to package yet another module, and it is easily skippable
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 gh#twisted/twisted#2280e5fcd0c9e9d34f5b7650c68f19c1498e49cd
Patch7: stop-using-3-arg-throw.patch
BuildRequires: %{python_module hatch-fancy-pypi-readme}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module incremental >= 21.3.0}

View File

@@ -2,10 +2,10 @@
src/twisted/test/test_udp.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: Twisted-22.10.0/src/twisted/test/test_udp.py
Index: twisted-24.3.0/src/twisted/test/test_udp.py
===================================================================
--- Twisted-22.10.0.orig/src/twisted/test/test_udp.py
+++ Twisted-22.10.0/src/twisted/test/test_udp.py
--- twisted-24.3.0.orig/src/twisted/test/test_udp.py
+++ twisted-24.3.0/src/twisted/test/test_udp.py
@@ -8,7 +8,7 @@ Tests for implementations of L{IReactorU
@@ -15,7 +15,7 @@ Index: Twisted-22.10.0/src/twisted/test/test_udp.py
from twisted.internet import defer, error, interfaces, protocol, reactor, udp
from twisted.internet.defer import Deferred, gatherResults, maybeDeferred
@@ -581,6 +581,7 @@ class MulticastTests(TestCase):
@@ -578,6 +578,7 @@ class MulticastTests(TestCase):
skip = "This reactor does not support multicast"
def setUp(self):

View File

@@ -1,37 +0,0 @@
From 2280e5fcd0c9e9d34f5b7650c68f19c1498e49cd Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Fri, 27 Oct 2023 16:56:24 -0700
Subject: [PATCH] #12026 Adjust to deprecation of 3-arg generator.throw()
In Python 3.12, the 3-arg signature of generator.throw() is
deprecated, you're only supposed to use the 1-arg signature
where you pass only an exception instance. I *think* this is the
right thing to pass in this case.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
src/twisted/newsfragments/12026.bugfix | 1 +
src/twisted/python/failure.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
create mode 100644 src/twisted/newsfragments/12026.bugfix
diff --git a/src/twisted/newsfragments/12026.bugfix b/src/twisted/newsfragments/12026.bugfix
new file mode 100644
index 00000000000..4f06cf79a4a
--- /dev/null
+++ b/src/twisted/newsfragments/12026.bugfix
@@ -0,0 +1 @@
+twisted.python.failure.Failure now throws exception for generators without triggering a deprecation warnings on Python 3.12.
diff --git a/src/twisted/python/failure.py b/src/twisted/python/failure.py
index ca893ca4c94..c006d555e55 100644
--- a/src/twisted/python/failure.py
+++ b/src/twisted/python/failure.py
@@ -516,7 +516,7 @@ def throwExceptionIntoGenerator(self, g):
"""
# Note that the actual magic to find the traceback information
# is done in _findFailure.
- return g.throw(self.type, self.value, self.tb)
+ return g.throw(self.value.with_traceback(self.tb))
@classmethod
def _findFailure(cls):

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:987847a0790a2c597197613686e2784fd54167df3a55d0fb17c8412305d76ce5
size 3495627

BIN
twisted-24.3.0.tar.gz LFS Normal file

Binary file not shown.

View File

@@ -1,83 +0,0 @@
From 3038382d8b01912358419cee96a56730499881e1 Mon Sep 17 00:00:00 2001
From: Adi Roiban <adi.roiban@chevah.com>
Date: Mon, 18 Dec 2023 13:42:28 +0000
Subject: [PATCH 1/4] Run with latest Python.
---
.github/workflows/test.yaml | 6 +++---
src/twisted/newsfragments/12052.1.misc | 0
2 files changed, 3 insertions(+), 3 deletions(-)
create mode 100644 src/twisted/newsfragments/12052.1.misc
Index: twisted-23.10.0/src/twisted/trial/reporter.py
===================================================================
--- twisted-23.10.0.orig/src/twisted/trial/reporter.py
+++ twisted-23.10.0/src/twisted/trial/reporter.py
@@ -7,7 +7,7 @@
"""
Defines classes that handle the results of tests.
"""
-
+from __future__ import annotations
import os
import sys
@@ -16,7 +16,7 @@ import unittest as pyunit
import warnings
from collections import OrderedDict
from types import TracebackType
-from typing import TYPE_CHECKING, List, Tuple, Type, Union
+from typing import TYPE_CHECKING, List, Optional, Tuple, Type, Union
from zope.interface import implementer
@@ -87,6 +87,11 @@ class TestResult(pyunit.TestResult):
@ivar successes: count the number of successes achieved by the test run.
@type successes: C{int}
+
+ @ivar _startTime: The time when the current test was started. It defaults to
+ L{None}, which means that the test was skipped.
+ @ivar _lastTime: The duration of the current test run. It defaults to
+ L{None}, which means that the test was skipped.
"""
# Used when no todo provided to addExpectedFailure or addUnexpectedSuccess.
@@ -96,6 +101,9 @@ class TestResult(pyunit.TestResult):
expectedFailures: List[Tuple[itrial.ITestCase, str, "Todo"]] # type: ignore[assignment]
unexpectedSuccesses: List[Tuple[itrial.ITestCase, str]] # type: ignore[assignment]
successes: int
+ _testStarted: Optional[int]
+ # The duration of the test. It is None until the test completes.
+ _lastTime: Optional[int]
def __init__(self):
super().__init__()
@@ -104,6 +112,8 @@ class TestResult(pyunit.TestResult):
self.unexpectedSuccesses = []
self.successes = 0
self._timings = []
+ self._testStarted = None
+ self._lastTime = None
def __repr__(self) -> str:
return "<%s run=%d errors=%d failures=%d todos=%d dones=%d skips=%d>" % (
@@ -146,7 +156,8 @@ class TestResult(pyunit.TestResult):
@type test: L{pyunit.TestCase}
"""
super().stopTest(test)
- self._lastTime = self._getTime() - self._testStarted
+ if self._testStarted is not None:
+ self._lastTime = self._getTime() - self._testStarted
def addFailure(self, test, fail):
"""
Index: twisted-23.10.0/src/twisted/newsfragments/12052.removal
===================================================================
--- /dev/null
+++ twisted-23.10.0/src/twisted/newsfragments/12052.removal
@@ -0,0 +1,4 @@
+twisted.trial.reporter.TestRun.startTest() is no longer called for tests
+with skip annotation or skip attribute for Python 3.12.1 or newer.
+This is the result of upstream Python gh-106584 change.
+The behavior is not change in 3.12.0 or older.