summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-05-29 00:27:48 +0100
committerSam James <sam@gentoo.org>2023-05-29 00:31:52 +0100
commitd2c8622b7c5df457f8ab238774f3e1c3624aecd1 (patch)
tree8e4a52452dfc452cd98cd09724b34cc31c39f8ab /dev-python/twisted/files
parentsci-libs/onnx: Keyword 1.14.0 riscv, #907328 (diff)
downloadgentoo-d2c8622b7c5df457f8ab238774f3e1c3624aecd1.tar.gz
gentoo-d2c8622b7c5df457f8ab238774f3e1c3624aecd1.tar.bz2
gentoo-d2c8622b7c5df457f8ab238774f3e1c3624aecd1.zip
dev-python/twisted: backport some 3.11 fixes
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/twisted/files')
-rw-r--r--dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch100
-rw-r--r--dev-python/twisted/files/twisted-22.10.0-sendmail.patch28
-rw-r--r--dev-python/twisted/files/twisted-22.10.0-time.patch113
3 files changed, 241 insertions, 0 deletions
diff --git a/dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch b/dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch
new file mode 100644
index 000000000000..b75c97d4997f
--- /dev/null
+++ b/dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch
@@ -0,0 +1,100 @@
+https://src.fedoraproject.org/rpms/python-twisted/blob/rawhide/f/0003-Fix-tests-for-Python-3.11.patch
+
+From b0574816f622bc187389df2183e2bef0492fe5f5 Mon Sep 17 00:00:00 2001
+From: eevel <eevel@weezel3.weezelnet>
+Date: Wed, 2 Nov 2022 20:35:55 -0500
+Subject: [PATCH 3/6] Fix tests for Python 3.11
+
+This is based on a subset of commits from this pull request.
+
+https://github.com/twisted/twisted/pull/11734
+
+- fix twisted.persisted tests (cherry picked from commit 4f6d7fb0749429b092fe7538a7d2b11fe58319a6)
+- fix tests for twisted.spread (cherry picked from commit 525377178adfa987ed56be753aec0fce35d721dc)
+- fix test for twisted.web (cherry picked from commit afcc224a02f72e5d12fa35d223bd753e8086b135)
+- fix persisted tests in twisted.test (cherry picked from commit 4b5ab38b09b326cec7967e04bd4cae8a84bb6784)
+- fix twisted.trial tests (cherry picked from commit f8f56d45113e5f2467a5e8375186e5db6309dfc6)
+- make test_flatten backwards-compatible (cherry picked from commit d91675ac5ffe907fcdbb3d1cedb1240008d81fd1)
+--- a/src/twisted/persisted/aot.py
++++ b/src/twisted/persisted/aot.py
+@@ -399,8 +399,10 @@ class AOTUnjellier:
+ inst = klass.__new__(klass)
+ if hasattr(klass, "__setstate__"):
+ self.callAfter(inst.__setstate__, state)
+- else:
++ elif isinstance(state, dict):
+ inst.__dict__ = state
++ else:
++ inst.__dict__ = state.__getstate__()
+ return inst
+
+ elif c is Ref:
+--- a/src/twisted/spread/flavors.py
++++ b/src/twisted/spread/flavors.py
+@@ -398,6 +398,8 @@ class RemoteCopy(Unjellyable):
+ object's dictionary (or a filtered approximation of it depending
+ on my peer's perspective).
+ """
++ if not state:
++ state = {}
+ state = {
+ x.decode("utf8") if isinstance(x, bytes) else x: y for x, y in state.items()
+ }
+--- a/src/twisted/spread/jelly.py
++++ b/src/twisted/spread/jelly.py
+@@ -154,7 +154,8 @@ def _newInstance(cls, state):
+ instance = _createBlank(cls)
+
+ def defaultSetter(state):
+- instance.__dict__ = state
++ if isinstance(state, dict):
++ instance.__dict__ = state or {}
+
+ setter = getattr(instance, "__setstate__", defaultSetter)
+ setter(state)
+--- a/src/twisted/test/test_persisted.py
++++ b/src/twisted/test/test_persisted.py
+@@ -378,6 +378,10 @@ class AOTTests(TestCase):
+ def __dict__(self):
+ raise AttributeError()
+
++ @property
++ def __getstate__(self):
++ raise AttributeError()
++
+ self.assertRaises(TypeError, aot.jellyToSource, UnknownType())
+
+ def test_basicIdentity(self):
+--- a/src/twisted/trial/test/test_pyunitcompat.py
++++ b/src/twisted/trial/test/test_pyunitcompat.py
+@@ -218,8 +218,10 @@ class PyUnitResultTests(SynchronousTestCase):
+ pyresult = pyunit.TestResult()
+ result = PyUnitResultAdapter(pyresult)
+ result.addError(self, f)
++ tback = "".join(traceback.format_exception(*exc_info))
+ self.assertEqual(
+- pyresult.errors[0][1], "".join(traceback.format_exception(*exc_info))
++ pyresult.errors[0][1].endswith("ZeroDivisionError: division by zero\n"),
++ tback.endswith("ZeroDivisionError: division by zero\n"),
+ )
+
+ def test_trialSkip(self):
+--- a/src/twisted/web/test/test_flatten.py
++++ b/src/twisted/web/test/test_flatten.py
+@@ -706,10 +706,9 @@ class FlattenerErrorTests(SynchronousTestCase):
+ Exception while flattening:
+ \\[<unrenderable>\\]
+ <unrenderable>
+- .*
++ <Deferred at .* current result: <twisted.python.failure.Failure builtins.RuntimeError: example>>
+ File ".*", line \\d*, in _flattenTree
+- element = await element
+- RuntimeError: example
++ element = await element.*
+ """
+ ),
+ flags=re.MULTILINE,
+--
+2.39.2
+
+
diff --git a/dev-python/twisted/files/twisted-22.10.0-sendmail.patch b/dev-python/twisted/files/twisted-22.10.0-sendmail.patch
new file mode 100644
index 000000000000..eec57752815d
--- /dev/null
+++ b/dev-python/twisted/files/twisted-22.10.0-sendmail.patch
@@ -0,0 +1,28 @@
+https://src.fedoraproject.org/rpms/python-twisted/raw/rawhide/f/0005-fix-sendmail-tests-for-python-3.11.patch
+
+From f29ae1ae433cd9529410a93fd5675cb01460460e Mon Sep 17 00:00:00 2001
+From: eevel <eevel@weezel3.weezelnet>
+Date: Wed, 26 Oct 2022 19:49:33 -0500
+Subject: [PATCH 5/6] fix sendmail tests for python 3.11
+
+(cherry picked from commit 00bf5be704bee022ba4d9b24eb6c2c768b4a1921)
+--- a/src/twisted/mail/test/test_smtp.py
++++ b/src/twisted/mail/test/test_smtp.py
+@@ -1771,7 +1771,8 @@ class SendmailTests(TestCase):
+ The default C{reactor} parameter of L{twisted.mail.smtp.sendmail} is
+ L{twisted.internet.reactor}.
+ """
+- args, varArgs, keywords, defaults = inspect.getargspec(smtp.sendmail)
++ fullSpec = inspect.getfullargspec(smtp.sendmail)
++ defaults = fullSpec[3]
+ self.assertEqual(reactor, defaults[2])
+
+ def _honorsESMTPArguments(self, username, password):
+--- /dev/null
++++ b/src/twisted/newsfragments/10345.misc
+@@ -0,0 +1 @@
++Fix SendmailTests for python 3.11.
+--
+2.39.2
+
+
diff --git a/dev-python/twisted/files/twisted-22.10.0-time.patch b/dev-python/twisted/files/twisted-22.10.0-time.patch
new file mode 100644
index 000000000000..1723d69c8a3c
--- /dev/null
+++ b/dev-python/twisted/files/twisted-22.10.0-time.patch
@@ -0,0 +1,113 @@
+From 75e5e6ba1793efdfef2e2cfada0425bad5f0bcfa Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Fri, 9 Dec 2022 10:16:42 -0800
+Subject: [PATCH 4/6] #11786 fix misuse of mktime in tests
+
+(cherry picked from commit da3bf3dc29f067e7019b2a1c205834ab64b2139a)
+--- a/src/twisted/logger/test/test_format.py
++++ b/src/twisted/logger/test/test_format.py
+@@ -166,16 +166,17 @@ class TimeFormattingTests(unittest.TestCase):
+ def testForTimeZone(name: str, expectedDST: str, expectedSTD: str) -> None:
+ setTZ(name)
+
+- localDST = mktime((2006, 6, 30, 0, 0, 0, 4, 181, 1))
+ localSTD = mktime((2007, 1, 31, 0, 0, 0, 2, 31, 0))
+-
+- self.assertEqual(formatTime(localDST), expectedDST)
+ self.assertEqual(formatTime(localSTD), expectedSTD)
+
++ if expectedDST:
++ localDST = mktime((2006, 6, 30, 0, 0, 0, 4, 181, 1))
++ self.assertEqual(formatTime(localDST), expectedDST)
++
+ # UTC
+ testForTimeZone(
+ "UTC+00",
+- "2006-06-30T00:00:00+0000",
++ None,
+ "2007-01-31T00:00:00+0000",
+ )
+
+@@ -196,7 +197,7 @@ class TimeFormattingTests(unittest.TestCase):
+ # No DST
+ testForTimeZone(
+ "CST+06",
+- "2006-06-30T00:00:00-0600",
++ None,
+ "2007-01-31T00:00:00-0600",
+ )
+
+@@ -211,7 +212,7 @@ class TimeFormattingTests(unittest.TestCase):
+ """
+ If C{timeFormat} argument is L{None}, we get the default output.
+ """
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ self.assertEqual(formatTime(t, timeFormat=None), "-")
+ self.assertEqual(formatTime(t, timeFormat=None, default="!"), "!")
+
+@@ -219,7 +220,7 @@ class TimeFormattingTests(unittest.TestCase):
+ """
+ Alternate time format in output.
+ """
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ self.assertEqual(formatTime(t, timeFormat="%Y/%W"), "2013/38")
+
+ def test_formatTimePercentF(self) -> None:
+@@ -246,7 +247,7 @@ class ClassicLogFormattingTests(unittest.TestCase):
+ addTZCleanup(self)
+ setTZ("UTC+00")
+
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ event = dict(log_format="XYZZY", log_time=t)
+ self.assertEqual(
+ formatEventAsClassicLogText(event),
+@@ -539,7 +540,7 @@ class EventAsTextTests(unittest.TestCase):
+ except CapturedError:
+ f = Failure()
+
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ event: LogEvent = {
+ "log_format": "ABCD",
+ "log_system": "fake_system",
+@@ -573,7 +574,7 @@ class EventAsTextTests(unittest.TestCase):
+ except CapturedError:
+ f = Failure()
+
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ event: LogEvent = {
+ "log_format": "ABCD",
+ "log_system": "fake_system",
+@@ -601,7 +602,7 @@ class EventAsTextTests(unittest.TestCase):
+ except CapturedError:
+ f = Failure()
+
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ event: LogEvent = {
+ "log_format": "ABCD",
+ "log_time": t,
+@@ -628,7 +629,7 @@ class EventAsTextTests(unittest.TestCase):
+ except CapturedError:
+ f = Failure()
+
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ event: LogEvent = {
+ "log_format": "ABCD",
+ "log_time": t,
+@@ -657,7 +658,7 @@ class EventAsTextTests(unittest.TestCase):
+ except CapturedError:
+ f = Failure()
+
+- t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++ t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+ event: LogEvent = {
+ "log_format": "ABCD",
+ "log_time": t,
+--
+2.39.2