summaryrefslogtreecommitdiff
path: root/dev-python/twisted/files
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/twisted/files')
-rw-r--r--dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch41
-rw-r--r--dev-python/twisted/files/twisted-19.10.0-py38.patch110
-rw-r--r--dev-python/twisted/files/twisted-19.10.0-py39-b64.patch165
-rw-r--r--dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch259
-rw-r--r--dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch94
-rw-r--r--dev-python/twisted/files/twisted-20.3.0-py39-b64.patch158
-rw-r--r--dev-python/twisted/files/twisted-20.3.0-py39-combined.patch115
-rw-r--r--dev-python/twisted/files/twisted-21.7.0-force-gtk3.patch67
8 files changed, 67 insertions, 942 deletions
diff --git a/dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch b/dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch
deleted file mode 100644
index 5fc4768e5d23..000000000000
--- a/dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
-index 6001d1e40..1cf9172ef 100644
---- a/src/twisted/web/test/test_http.py
-+++ b/src/twisted/web/test/test_http.py
-@@ -9,15 +9,15 @@ from __future__ import absolute_import, division
-
- import base64
- import calendar
--import cgi
- import random
-
- import hamcrest
-
- try:
- from urlparse import urlparse, urlunsplit, clear_cache
-+ from cgi import parse_qs
- except ImportError:
-- from urllib.parse import urlparse, urlunsplit, clear_cache
-+ from urllib.parse import urlparse, urlunsplit, clear_cache, parse_qs
-
- from io import BytesIO
- from itertools import cycle
-@@ -2156,15 +2156,15 @@ Hello,
- class QueryArgumentsTests(unittest.TestCase):
- def testParseqs(self):
- self.assertEqual(
-- cgi.parse_qs(b"a=b&d=c;+=f"),
-+ parse_qs(b"a=b&d=c;+=f"),
- http.parse_qs(b"a=b&d=c;+=f"))
- self.assertRaises(
- ValueError, http.parse_qs, b"blah", strict_parsing=True)
- self.assertEqual(
-- cgi.parse_qs(b"a=&b=c", keep_blank_values=1),
-+ parse_qs(b"a=&b=c", keep_blank_values=1),
- http.parse_qs(b"a=&b=c", keep_blank_values=1))
- self.assertEqual(
-- cgi.parse_qs(b"a=&b=c"),
-+ parse_qs(b"a=&b=c"),
- http.parse_qs(b"a=&b=c"))
-
-
diff --git a/dev-python/twisted/files/twisted-19.10.0-py38.patch b/dev-python/twisted/files/twisted-19.10.0-py38.patch
deleted file mode 100644
index e787167d45b3..000000000000
--- a/dev-python/twisted/files/twisted-19.10.0-py38.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From d33b90880b8eb024daa73bc3fd39aca0bc791ff1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lucas=20Treffenst=C3=A4dt?= <lucas@treffenstaedt.de>
-Date: Mon, 13 Jan 2020 13:54:08 +0100
-Subject: [PATCH 1/2] CramMD5ClientAuthenticator now specifies the digestmod
- argument to hmac.HMAC constructor explicitly.
-
----
- src/twisted/mail/_cred.py | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/twisted/mail/_cred.py b/src/twisted/mail/_cred.py
-index 9d3646948..43c406f90 100644
---- a/src/twisted/mail/_cred.py
-+++ b/src/twisted/mail/_cred.py
-@@ -8,6 +8,7 @@ Credential managers for L{twisted.mail}.
- from __future__ import absolute_import, division
-
- import hmac
-+import hashlib
-
- from zope.interface import implementer
-
-@@ -28,7 +29,7 @@ class CramMD5ClientAuthenticator:
-
-
- def challengeResponse(self, secret, chal):
-- response = hmac.HMAC(secret, chal).hexdigest().encode('ascii')
-+ response = hmac.HMAC(secret, chal, digestmod = hashlib.md5).hexdigest().encode('ascii')
- return self.user + b' ' + response
-
-
---
-2.26.2
-
-From 694bc67f3cf7d36a6f512f0b76882e85d0966dd2 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Poisson?= <goffi@goffi.org>
-Date: Sun, 17 Nov 2019 19:48:53 +0100
-Subject: [PATCH 2/2] Fix parsing of namespaced attributes with Python 3.8 in
- twisted.words.xish.domish.ExpatElementStream
-
----
- src/twisted/words/newsfragments/9730.bugfix | 1 +
- src/twisted/words/test/test_domish.py | 17 +++++++++++++++++
- src/twisted/words/xish/domish.py | 11 +++++++++--
- 3 files changed, 27 insertions(+), 2 deletions(-)
- create mode 100644 src/twisted/words/newsfragments/9730.bugfix
-
-diff --git a/src/twisted/words/newsfragments/9730.bugfix b/src/twisted/words/newsfragments/9730.bugfix
-new file mode 100644
-index 000000000..5c91305c8
---- /dev/null
-+++ b/src/twisted/words/newsfragments/9730.bugfix
-@@ -0,0 +1 @@
-+Fixed parsing of streams with Python 3.8 when there are spaces in namespaces or namespaced attributes in twisted.words.xish.domish.ExpatElementStream
-diff --git a/src/twisted/words/test/test_domish.py b/src/twisted/words/test/test_domish.py
-index a8f8fa76b..cd16e3a4d 100644
---- a/src/twisted/words/test/test_domish.py
-+++ b/src/twisted/words/test/test_domish.py
-@@ -350,6 +350,23 @@ class DomishStreamTestsMixin:
- self.elements[0].attributes, {(" bar baz ", "baz"): "quux"})
-
-
-+ def test_attributesWithNamespaces(self):
-+ """
-+ Attributes with namespace are parsed without Exception.
-+ (https://twistedmatrix.com/trac/ticket/9730 regression test)
-+ """
-+
-+ xml = b"""<root xmlns:test='http://example.org' xml:lang='en'>
-+ <test:test>test</test:test>
-+ </root>"""
-+
-+ # with Python 3.8 and without #9730 fix, the following error would
-+ # happen at next line:
-+ # ``RuntimeError: dictionary keys changed during iteration``
-+ self.stream.parse(xml)
-+ self.assertEqual(self.elements[0].uri, "http://example.org")
-+
-+
- def testChildPrefix(self):
- xml = b"<root xmlns='testns' xmlns:foo='testns2'><foo:child/></root>"
-
-diff --git a/src/twisted/words/xish/domish.py b/src/twisted/words/xish/domish.py
-index 2063c410a..fc49285f5 100644
---- a/src/twisted/words/xish/domish.py
-+++ b/src/twisted/words/xish/domish.py
-@@ -807,11 +807,18 @@ class ExpatElementStream:
- qname = ('', name)
-
- # Process attributes
-+ newAttrs = {}
-+ toDelete = []
- for k, v in attrs.items():
- if " " in k:
- aqname = k.rsplit(" ", 1)
-- attrs[(aqname[0], aqname[1])] = v
-- del attrs[k]
-+ newAttrs[(aqname[0], aqname[1])] = v
-+ toDelete.append(k)
-+
-+ attrs.update(newAttrs)
-+
-+ for k in toDelete:
-+ del attrs[k]
-
- # Construct the new element
- e = Element(qname, self.defaultNsStack[-1], attrs, self.localPrefixes)
---
-2.26.2
-
diff --git a/dev-python/twisted/files/twisted-19.10.0-py39-b64.patch b/dev-python/twisted/files/twisted-19.10.0-py39-b64.patch
deleted file mode 100644
index f67d6240558a..000000000000
--- a/dev-python/twisted/files/twisted-19.10.0-py39-b64.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From f56133a2e0d7ddf9ee6e43bf9e1d62e970cb0b3a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 27 May 2020 13:23:37 +0200
-Subject: [PATCH] Replace base64.*string() functions to fix py3.9 support
-
-Replace base64.decodestring() and .encodestring() functions as they
-were deprecated since Python 3.1 in favor of (equivalent) .decodebytes()
-and .encodebytes(), and were eventually removed in Python 3.9.
-
-While at it, replace most of their uses with base64.b64encode()
-and .b64decode() that are preferable to the former wrt ticket #6446,
-and they do not introduce line breaks that the twisted code usually
-discarded.
-
-Use .decodebytes() and .encodebytes() in DirDBM as it seems to rely
-on the exact presence of newlines, and changing that would break
-backwards compatibility.
-
-Fixes: ticket:6446
-Fixes: ticket:9831
----
- src/twisted/conch/scripts/tkconch.py | 2 +-
- src/twisted/conch/test/test_keys.py | 2 +-
- src/twisted/mail/pop3.py | 4 ++--
- src/twisted/mail/test/test_pop3.py | 4 ++--
- src/twisted/persisted/dirdbm.py | 10 ++++++++--
- src/twisted/web/http.py | 2 +-
- src/twisted/web/test/test_http.py | 6 +++---
- 14 files changed, 18 insertions(+), 12 deletions(-)
-
-diff --git a/src/twisted/conch/scripts/tkconch.py b/src/twisted/conch/scripts/tkconch.py
-index 9c48e8a7f..5e007ebdc 100644
---- a/src/twisted/conch/scripts/tkconch.py
-+++ b/src/twisted/conch/scripts/tkconch.py
-@@ -409,7 +409,7 @@ class SSHClientTransport(transport.SSHClientTransport):
- "known hosts.\r\n" %
- (khHost, {b'ssh-dss':'DSA', b'ssh-rsa':'RSA'}[keyType]))
- with open(os.path.expanduser('~/.ssh/known_hosts'), 'a') as known_hosts:
-- encodedKey = base64.encodestring(pubKey).replace(b'\n', b'')
-+ encodedKey = base64.b64encode(pubKey)
- known_hosts.write('\n%s %s %s' % (khHost, keyType, encodedKey))
- except:
- log.deferr()
-diff --git a/src/twisted/conch/test/test_keys.py b/src/twisted/conch/test/test_keys.py
-index 41e49f415..795e7b8d7 100644
---- a/src/twisted/conch/test/test_keys.py
-+++ b/src/twisted/conch/test/test_keys.py
-@@ -352,7 +352,7 @@ SUrCyZXsNh6VXwjs3gKQ
-
- self.assertRaises(
- keys.BadKeyError,
-- keys.Key.fromString, data=b'{' + base64.encodestring(sexp) + b'}',
-+ keys.Key.fromString, data=b'{' + base64.b64encode(sexp) + b'}',
- )
-
-
-diff --git a/src/twisted/mail/pop3.py b/src/twisted/mail/pop3.py
-index ffe9714c9..057389e3a 100644
---- a/src/twisted/mail/pop3.py
-+++ b/src/twisted/mail/pop3.py
-@@ -728,7 +728,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
- self._auth = auth()
- chal = self._auth.getChallenge()
-
-- self.sendLine(b'+ ' + base64.encodestring(chal).rstrip(b'\n'))
-+ self.sendLine(b'+ ' + base64.b64encode(chal))
- self.state = 'AUTH'
-
-
-@@ -747,7 +747,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
- """
- self.state = "COMMAND"
- try:
-- parts = base64.decodestring(line).split(None, 1)
-+ parts = base64.b64decode(line).split(None, 1)
- except binascii.Error:
- self.failResponse(b"Invalid BASE64 encoding")
- else:
-diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
-index ea513487c..36780d9c9 100644
---- a/src/twisted/mail/test/test_pop3.py
-+++ b/src/twisted/mail/test/test_pop3.py
-@@ -1097,12 +1097,12 @@ class SASLTests(unittest.TestCase):
-
- p.lineReceived(b"AUTH CRAM-MD5")
- chal = s.getvalue().splitlines()[-1][2:]
-- chal = base64.decodestring(chal)
-+ chal = base64.b64decode(chal)
- response = hmac.HMAC(b'testpassword', chal,
- digestmod=md5).hexdigest().encode("ascii")
-
- p.lineReceived(
-- base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
-+ base64.b64encode(b'testuser ' + response))
- self.assertTrue(p.mbox)
- self.assertTrue(s.getvalue().splitlines()[-1].find(b"+OK") >= 0)
- p.connectionLost(failure.Failure(Exception("Test harness disconnect")))
-diff --git a/src/twisted/persisted/dirdbm.py b/src/twisted/persisted/dirdbm.py
-index f97c526d0..d9f29cce2 100644
---- a/src/twisted/persisted/dirdbm.py
-+++ b/src/twisted/persisted/dirdbm.py
-@@ -81,14 +81,20 @@ class DirDBM:
- Encode a key so it can be used as a filename.
- """
- # NOTE: '_' is NOT in the base64 alphabet!
-- return base64.encodestring(k).replace(b'\n', b'_').replace(b"/", b"-")
-+ try:
-+ return base64.encodebytes(k).replace(b'\n', b'_').replace(b"/", b"-")
-+ except AttributeError:
-+ return base64.encodestring(k).replace(b'\n', b'_').replace(b"/", b"-")
-
-
- def _decode(self, k):
- """
- Decode a filename to get the key.
- """
-- return base64.decodestring(k.replace(b'_', b'\n').replace(b"-", b"/"))
-+ try:
-+ return base64.decodebytes(k.replace(b'_', b'\n').replace(b"-", b"/"))
-+ except AttributeError:
-+ return base64.decodestring(k.replace(b'_', b'\n').replace(b"-", b"/"))
-
-
- def _readFile(self, path):
-diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
-index fe88d3373..602a58f31 100644
---- a/src/twisted/web/http.py
-+++ b/src/twisted/web/http.py
-@@ -1540,7 +1540,7 @@ class Request:
- bas, upw = authh.split()
- if bas.lower() != b"basic":
- raise ValueError()
-- upw = base64.decodestring(upw)
-+ upw = base64.b64decode(upw)
- self.user, self.password = upw.split(b':', 1)
- except (binascii.Error, ValueError):
- self.user = self.password = ""
-diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
-index 6001d1e40..70065e232 100644
---- a/src/twisted/web/test/test_http.py
-+++ b/src/twisted/web/test/test_http.py
-@@ -1513,7 +1513,7 @@ class ParsingTests(unittest.TestCase):
- requests.append(self)
-
- for u, p in [(b"foo", b"bar"), (b"hello", b"there:z")]:
-- s = base64.encodestring(b":".join((u, p))).strip()
-+ s = base64.b64encode(b":".join((u, p)))
- f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
- self.runRequest(f, Request, 0)
- req = requests.pop()
-@@ -2139,9 +2139,9 @@ Hello,
-
- u = b"foo"
- p = b"bar"
-- s = base64.encodestring(b":".join((u, p))).strip()
-+ s = base64.b64encode(b":".join((u, p)))
- f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
-- self.patch(base64, 'decodestring', lambda x: [])
-+ self.patch(base64, 'b64decode', lambda x: [])
- self.runRequest(f, Request, 0)
- req = requests.pop()
- self.assertEqual(('', ''), req.credentials)
---
-2.26.2
-
diff --git a/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch b/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch
deleted file mode 100644
index 5151f297f7f4..000000000000
--- a/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch
+++ /dev/null
@@ -1,259 +0,0 @@
-From 62ab0203c59c1f9788c53dfad4a212774094d05c Mon Sep 17 00:00:00 2001
-From: Craig Rodrigues <rodrigc@FreeBSD.org>
-Date: Mon, 13 Apr 2020 01:22:23 -0700
-Subject: [PATCH 2/2] Merge 9801-rodrigc-cgi: Change import of cgi.parse_qs to
- urllib.parse.parse_qs
-
-Author: rodrigc
-Reviewer: hawkowl
-Fixes: ticket:9801
----
- src/twisted/web/client.py | 17 ++++-----
- src/twisted/web/http.py | 49 ++++++++++++-------------
- src/twisted/web/newsfragments/9801.misc | 0
- src/twisted/web/test/test_http.py | 41 +++------------------
- src/twisted/web/test/test_webclient.py | 5 +--
- 5 files changed, 38 insertions(+), 74 deletions(-)
- create mode 100644 src/twisted/web/newsfragments/9801.misc
-
-diff --git a/src/twisted/web/client.py b/src/twisted/web/client.py
-index 7e4642ef3..8209f5a5e 100644
---- a/src/twisted/web/client.py
-+++ b/src/twisted/web/client.py
-@@ -12,15 +12,8 @@ import os
- import collections
- import warnings
-
--try:
-- from urlparse import urlunparse, urljoin, urldefrag
--except ImportError:
-- from urllib.parse import urljoin, urldefrag
-- from urllib.parse import urlunparse as _urlunparse
--
-- def urlunparse(parts):
-- result = _urlunparse(tuple([p.decode("charmap") for p in parts]))
-- return result.encode("charmap")
-+from urllib.parse import urljoin, urldefrag
-+from urllib.parse import urlunparse as _urlunparse
-
- import zlib
- from functools import wraps
-@@ -51,6 +44,12 @@ from twisted.web._newclient import _ensureValidURI, _ensureValidMethod
-
-
-
-+def urlunparse(parts):
-+ result = _urlunparse(tuple([p.decode("charmap") for p in parts]))
-+ return result.encode("charmap")
-+
-+
-+
- class PartialDownloadError(error.Error):
- """
- Page was only partially downloaded, we got disconnected in middle.
-diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
-index b7afa8b0d..94d0ae81f 100644
---- a/src/twisted/web/http.py
-+++ b/src/twisted/web/http.py
-@@ -66,27 +66,10 @@ import time
- import calendar
- import warnings
- import os
--from io import BytesIO as StringIO
--
--try:
-- from urlparse import (
-- ParseResult as ParseResultBytes, urlparse as _urlparse)
-- from urllib import unquote
-- from cgi import parse_header as _parseHeader
--except ImportError:
-- from urllib.parse import (
-- ParseResultBytes, urlparse as _urlparse, unquote_to_bytes as unquote)
--
-- def _parseHeader(line):
-- # cgi.parse_header requires a str
-- key, pdict = cgi.parse_header(line.decode('charmap'))
--
-- # We want the key as bytes, and cgi.parse_multipart (which consumes
-- # pdict) expects a dict of str keys but bytes values
-- key = key.encode('charmap')
-- pdict = {x:y.encode('charmap') for x, y in pdict.items()}
-- return (key, pdict)
-+from io import BytesIO
-
-+from urllib.parse import (
-+ ParseResultBytes, urlparse as _urlparse, unquote_to_bytes as unquote)
-
- from zope.interface import Attribute, Interface, implementer, provider
-
-@@ -163,6 +146,20 @@ monthname = [None,
- weekdayname_lower = [name.lower() for name in weekdayname]
- monthname_lower = [name and name.lower() for name in monthname]
-
-+
-+
-+def _parseHeader(line):
-+ # cgi.parse_header requires a str
-+ key, pdict = cgi.parse_header(line.decode('charmap'))
-+
-+ # We want the key as bytes, and cgi.parse_multipart (which consumes
-+ # pdict) expects a dict of str keys but bytes values
-+ key = key.encode('charmap')
-+ pdict = {x: y.encode('charmap') for x, y in pdict.items()}
-+ return (key, pdict)
-+
-+
-+
- def urlparse(url):
- """
- Parse an URL into six components.
-@@ -486,13 +483,15 @@ class _IDeprecatedHTTPChannelToRequestInterface(Interface):
-
- class StringTransport:
- """
-- I am a StringIO wrapper that conforms for the transport API. I support
-+ I am a BytesIO wrapper that conforms for the transport API. I support
- the `writeSequence' method.
- """
- def __init__(self):
-- self.s = StringIO()
-+ self.s = BytesIO()
-+
- def writeSequence(self, seq):
- self.s.write(b''.join(seq))
-+
- def __getattr__(self, attr):
- return getattr(self.__dict__['s'], attr)
-
-@@ -513,7 +512,7 @@ class HTTPClient(basic.LineReceiver):
- @type firstLine: C{bool}
-
- @ivar __buffer: The buffer that stores the response to the HTTP request.
-- @type __buffer: A C{StringIO} object.
-+ @type __buffer: A C{BytesIO} object.
-
- @ivar _header: Part or all of an HTTP request header.
- @type _header: C{bytes}
-@@ -579,7 +578,7 @@ class HTTPClient(basic.LineReceiver):
- if self._header != b"":
- # Only extract headers if there are any
- self.extractHeader(self._header)
-- self.__buffer = StringIO()
-+ self.__buffer = BytesIO()
- self.handleEndHeaders()
- self.setRawMode()
- return
-@@ -665,7 +664,7 @@ def _getContentFile(length):
- Get a writeable file-like object to which request content can be written.
- """
- if length is not None and length < 100000:
-- return StringIO()
-+ return BytesIO()
- return tempfile.TemporaryFile()
-
-
-diff --git a/src/twisted/web/newsfragments/9801.misc b/src/twisted/web/newsfragments/9801.misc
-new file mode 100644
-index 000000000..e69de29bb
-diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
-index a3067f732..4189b307c 100644
---- a/src/twisted/web/test/test_http.py
-+++ b/src/twisted/web/test/test_http.py
-@@ -9,15 +9,11 @@ from __future__ import absolute_import, division
-
- import base64
- import calendar
--import cgi
- import random
-
- import hamcrest
-
--try:
-- from urlparse import urlparse, urlunsplit, clear_cache
--except ImportError:
-- from urllib.parse import urlparse, urlunsplit, clear_cache
-+from urllib.parse import urlparse, urlunsplit, clear_cache, parse_qs
-
- from io import BytesIO
- from itertools import cycle
-@@ -28,7 +24,7 @@ from zope.interface import (
- )
- from zope.interface.verify import verifyObject
-
--from twisted.python.compat import (_PY3, iterbytes, long, networkString,
-+from twisted.python.compat import (iterbytes, long, networkString,
- unicode, intToBytes)
- from twisted.python.components import proxyForInterface
- from twisted.python.failure import Failure
-@@ -2019,33 +2015,6 @@ Content-Type: application/x-www-form-urlencoded
- self.assertEqual(content, [networkString(query)])
-
-
-- def test_missingContentDisposition(self):
-- """
-- If the C{Content-Disposition} header is missing, the request is denied
-- as a bad request.
-- """
-- req = b'''\
--POST / HTTP/1.0
--Content-Type: multipart/form-data; boundary=AaB03x
--Content-Length: 103
--
----AaB03x
--Content-Type: text/plain
--Content-Transfer-Encoding: quoted-printable
--
--abasdfg
----AaB03x--
--'''
-- channel = self.runRequest(req, http.Request, success=False)
-- self.assertEqual(
-- channel.transport.value(),
-- b"HTTP/1.1 400 Bad Request\r\n\r\n")
--
-- if _PY3:
-- test_missingContentDisposition.skip = (
-- "cgi.parse_multipart is much more error-tolerant on Python 3.")
--
--
- def test_multipartProcessingFailure(self):
- """
- When the multipart processing fails the client gets a 400 Bad Request.
-@@ -2373,15 +2342,15 @@ ok
- class QueryArgumentsTests(unittest.TestCase):
- def testParseqs(self):
- self.assertEqual(
-- cgi.parse_qs(b"a=b&d=c;+=f"),
-+ parse_qs(b"a=b&d=c;+=f"),
- http.parse_qs(b"a=b&d=c;+=f"))
- self.assertRaises(
- ValueError, http.parse_qs, b"blah", strict_parsing=True)
- self.assertEqual(
-- cgi.parse_qs(b"a=&b=c", keep_blank_values=1),
-+ parse_qs(b"a=&b=c", keep_blank_values=1),
- http.parse_qs(b"a=&b=c", keep_blank_values=1))
- self.assertEqual(
-- cgi.parse_qs(b"a=&b=c"),
-+ parse_qs(b"a=&b=c"),
- http.parse_qs(b"a=&b=c"))
-
-
-diff --git a/src/twisted/web/test/test_webclient.py b/src/twisted/web/test/test_webclient.py
-index 680e02780..672594993 100644
---- a/src/twisted/web/test/test_webclient.py
-+++ b/src/twisted/web/test/test_webclient.py
-@@ -11,10 +11,7 @@ import io
- import os
- from errno import ENOSPC
-
--try:
-- from urlparse import urlparse, urljoin
--except ImportError:
-- from urllib.parse import urlparse, urljoin
-+from urllib.parse import urlparse, urljoin
-
- from twisted.python.compat import networkString, nativeString, intToBytes
- from twisted.trial import unittest, util
---
-2.26.2
-
diff --git a/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch b/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch
deleted file mode 100644
index 1c1ee01b2187..000000000000
--- a/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From 653fb2aea0ca1f60558917d52f4ff0c33cd7b067 Mon Sep 17 00:00:00 2001
-From: Craig Rodrigues <rodrigc@crodrigues.org>
-Date: Sun, 12 Apr 2020 14:28:23 -0700
-Subject: [PATCH 1/2] Add digestmod parameter to HMAC.__init__() invocations
-
-This parameter is now required on Python 3.8+
----
- src/twisted/cred/credentials.py | 3 ++-
- src/twisted/cred/test/test_cramauth.py | 11 ++++++++---
- src/twisted/mail/test/test_pop3.py | 4 +++-
- 3 files changed, 13 insertions(+), 5 deletions(-)
-
-diff --git a/src/twisted/cred/credentials.py b/src/twisted/cred/credentials.py
-index 5469e5158..67c24cb01 100644
---- a/src/twisted/cred/credentials.py
-+++ b/src/twisted/cred/credentials.py
-@@ -441,7 +441,8 @@ class CramMD5Credentials(object):
-
-
- def checkPassword(self, password):
-- verify = hexlify(hmac.HMAC(password, self.challenge).digest())
-+ verify = hexlify(hmac.HMAC(password, self.challenge,
-+ digestmod=md5).digest())
- return verify == self.response
-
-
-diff --git a/src/twisted/cred/test/test_cramauth.py b/src/twisted/cred/test/test_cramauth.py
-index 1ee08712b..d21f2f68c 100644
---- a/src/twisted/cred/test/test_cramauth.py
-+++ b/src/twisted/cred/test/test_cramauth.py
-@@ -7,6 +7,8 @@ Tests for L{twisted.cred}'s implementation of CRAM-MD5.
-
- from __future__ import division, absolute_import
-
-+import hashlib
-+
- from hmac import HMAC
- from binascii import hexlify
-
-@@ -39,7 +41,8 @@ class CramMD5CredentialsTests(TestCase):
- """
- c = CramMD5Credentials()
- chal = c.getChallenge()
-- c.response = hexlify(HMAC(b'secret', chal).digest())
-+ c.response = hexlify(HMAC(b'secret', chal,
-+ digestmod=hashlib.md5).digest())
- self.assertTrue(c.checkPassword(b'secret'))
-
-
-@@ -61,7 +64,8 @@ class CramMD5CredentialsTests(TestCase):
- """
- c = CramMD5Credentials()
- chal = c.getChallenge()
-- c.response = hexlify(HMAC(b'thewrongsecret', chal).digest())
-+ c.response = hexlify(HMAC(b'thewrongsecret', chal,
-+ digestmod=hashlib.md5).digest())
- self.assertFalse(c.checkPassword(b'secret'))
-
-
-@@ -75,7 +79,8 @@ class CramMD5CredentialsTests(TestCase):
- chal = c.getChallenge()
- c.setResponse(b" ".join(
- (b"squirrel",
-- hexlify(HMAC(b'supersecret', chal).digest()))))
-+ hexlify(HMAC(b'supersecret', chal,
-+ digestmod=hashlib.md5).digest()))))
- self.assertTrue(c.checkPassword(b'supersecret'))
- self.assertEqual(c.username, b"squirrel")
-
-diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
-index 4a59c3b49..ea513487c 100644
---- a/src/twisted/mail/test/test_pop3.py
-+++ b/src/twisted/mail/test/test_pop3.py
-@@ -11,6 +11,7 @@ import hmac
- import base64
- import itertools
-
-+from hashlib import md5
- from collections import OrderedDict
- from io import BytesIO
-
-@@ -1097,7 +1098,8 @@ class SASLTests(unittest.TestCase):
- p.lineReceived(b"AUTH CRAM-MD5")
- chal = s.getvalue().splitlines()[-1][2:]
- chal = base64.decodestring(chal)
-- response = hmac.HMAC(b'testpassword', chal).hexdigest().encode("ascii")
-+ response = hmac.HMAC(b'testpassword', chal,
-+ digestmod=md5).hexdigest().encode("ascii")
-
- p.lineReceived(
- base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
---
-2.26.2
-
diff --git a/dev-python/twisted/files/twisted-20.3.0-py39-b64.patch b/dev-python/twisted/files/twisted-20.3.0-py39-b64.patch
deleted file mode 100644
index f475614df408..000000000000
--- a/dev-python/twisted/files/twisted-20.3.0-py39-b64.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-From f44c2ff111a8961d295409186cc07aaf414c76bc Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 27 May 2020 13:23:37 +0200
-Subject: [PATCH 1/4] Replace base64.*string() functions to fix py3.9 support
-
-Replace base64.decodestring() and .encodestring() functions as they
-were deprecated since Python 3.1 in favor of (equivalent) .decodebytes()
-and .encodebytes(), and were eventually removed in Python 3.9.
-
-While at it, replace most of their uses with base64.b64encode()
-and .b64decode() that are preferable to the former wrt ticket #6446,
-and they do not introduce line breaks that the twisted code usually
-discarded.
-
-Use .decodebytes() and .encodebytes() in DirDBM as it seems to rely
-on the exact presence of newlines, and changing that would break
-backwards compatibility.
-
-Fixes: ticket:6446
-Fixes: ticket:9831
----
- src/twisted/conch/scripts/tkconch.py | 2 +-
- src/twisted/conch/test/test_keys.py | 2 +-
- src/twisted/mail/pop3.py | 4 ++--
- src/twisted/mail/test/test_pop3.py | 4 ++--
- src/twisted/persisted/dirdbm.py | 4 ++--
- src/twisted/web/http.py | 2 +-
- src/twisted/web/test/test_http.py | 6 +++---
- 14 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git a/src/twisted/conch/scripts/tkconch.py b/src/twisted/conch/scripts/tkconch.py
-index a662cabc8..744734343 100644
---- a/src/twisted/conch/scripts/tkconch.py
-+++ b/src/twisted/conch/scripts/tkconch.py
-@@ -412,7 +412,7 @@ class SSHClientTransport(transport.SSHClientTransport):
- "known hosts.\r\n" %
- (khHost, {b'ssh-dss':'DSA', b'ssh-rsa':'RSA'}[keyType]))
- with open(os.path.expanduser('~/.ssh/known_hosts'), 'a') as known_hosts:
-- encodedKey = base64.encodestring(pubKey).replace(b'\n', b'')
-+ encodedKey = base64.b64encode(pubKey)
- known_hosts.write('\n%s %s %s' % (khHost, keyType, encodedKey))
- except:
- log.deferr()
-diff --git a/src/twisted/conch/test/test_keys.py b/src/twisted/conch/test/test_keys.py
-index 650a19bfb..f76cbd1b4 100644
---- a/src/twisted/conch/test/test_keys.py
-+++ b/src/twisted/conch/test/test_keys.py
-@@ -404,7 +404,7 @@ SUrCyZXsNh6VXwjs3gKQ
-
- self.assertRaises(
- keys.BadKeyError,
-- keys.Key.fromString, data=b'{' + base64.encodestring(sexp) + b'}',
-+ keys.Key.fromString, data=b'{' + base64.b64encode(sexp) + b'}',
- )
-
-
-diff --git a/src/twisted/mail/pop3.py b/src/twisted/mail/pop3.py
-index ffe9714c9..057389e3a 100644
---- a/src/twisted/mail/pop3.py
-+++ b/src/twisted/mail/pop3.py
-@@ -728,7 +728,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
- self._auth = auth()
- chal = self._auth.getChallenge()
-
-- self.sendLine(b'+ ' + base64.encodestring(chal).rstrip(b'\n'))
-+ self.sendLine(b'+ ' + base64.b64encode(chal))
- self.state = 'AUTH'
-
-
-@@ -747,7 +747,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
- """
- self.state = "COMMAND"
- try:
-- parts = base64.decodestring(line).split(None, 1)
-+ parts = base64.b64decode(line).split(None, 1)
- except binascii.Error:
- self.failResponse(b"Invalid BASE64 encoding")
- else:
-diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
-index f7fbfaf1e..af335ab2d 100644
---- a/src/twisted/mail/test/test_pop3.py
-+++ b/src/twisted/mail/test/test_pop3.py
-@@ -1096,12 +1096,12 @@ class SASLTests(unittest.TestCase):
-
- p.lineReceived(b"AUTH CRAM-MD5")
- chal = s.getvalue().splitlines()[-1][2:]
-- chal = base64.decodestring(chal)
-+ chal = base64.b64decode(chal)
- response = hmac.HMAC(b'testpassword', chal,
- digestmod=md5).hexdigest().encode("ascii")
-
- p.lineReceived(
-- base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
-+ base64.b64encode(b'testuser ' + response))
- self.assertTrue(p.mbox)
- self.assertTrue(s.getvalue().splitlines()[-1].find(b"+OK") >= 0)
- p.connectionLost(failure.Failure(Exception("Test harness disconnect")))
-diff --git a/src/twisted/persisted/dirdbm.py b/src/twisted/persisted/dirdbm.py
-index 3ba7a59d4..7659ff765 100644
---- a/src/twisted/persisted/dirdbm.py
-+++ b/src/twisted/persisted/dirdbm.py
-@@ -77,14 +77,14 @@ class DirDBM:
- Encode a key so it can be used as a filename.
- """
- # NOTE: '_' is NOT in the base64 alphabet!
-- return base64.encodestring(k).replace(b'\n', b'_').replace(b"/", b"-")
-+ return base64.encodebytes(k).replace(b'\n', b'_').replace(b"/", b"-")
-
-
- def _decode(self, k):
- """
- Decode a filename to get the key.
- """
-- return base64.decodestring(k.replace(b'_', b'\n').replace(b"-", b"/"))
-+ return base64.decodebytes(k.replace(b'_', b'\n').replace(b"-", b"/"))
-
-
- def _readFile(self, path):
-diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
-index 0e115741e..e9a080d21 100644
---- a/src/twisted/web/http.py
-+++ b/src/twisted/web/http.py
-@@ -1544,7 +1544,7 @@ class Request:
- bas, upw = authh.split()
- if bas.lower() != b"basic":
- raise ValueError()
-- upw = base64.decodestring(upw)
-+ upw = base64.b64decode(upw)
- self.user, self.password = upw.split(b':', 1)
- except (binascii.Error, ValueError):
- self.user = self.password = b''
-diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
-index 112e56f46..02a4674a7 100644
---- a/src/twisted/web/test/test_http.py
-+++ b/src/twisted/web/test/test_http.py
-@@ -1604,7 +1604,7 @@ class ParsingTests(unittest.TestCase):
- requests.append(self)
-
- for u, p in [(b"foo", b"bar"), (b"hello", b"there:z")]:
-- s = base64.encodestring(b":".join((u, p))).strip()
-+ s = base64.b64encode(b":".join((u, p)))
- f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
- self.runRequest(f, Request, 0)
- req = requests.pop()
-@@ -2209,9 +2209,9 @@ Hello,
-
- u = b"foo"
- p = b"bar"
-- s = base64.encodestring(b":".join((u, p))).strip()
-+ s = base64.b64encode(b":".join((u, p)))
- f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
-- self.patch(base64, 'decodestring', lambda x: [])
-+ self.patch(base64, 'b64decode', lambda x: [])
- self.runRequest(f, Request, 0)
- req = requests.pop()
- self.assertEqual((b'', b''), req.credentials)
---
-2.26.2
diff --git a/dev-python/twisted/files/twisted-20.3.0-py39-combined.patch b/dev-python/twisted/files/twisted-20.3.0-py39-combined.patch
deleted file mode 100644
index 0ed1f7b8d9c6..000000000000
--- a/dev-python/twisted/files/twisted-20.3.0-py39-combined.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 2d30860a8b71e90513ead9958f5dd312802b0d36 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 27 May 2020 14:40:53 +0200
-Subject: [PATCH 2/4] Fix imap4-utf-7 codec lookup function for Python 3.9
-
-Python 3.9 normalizes the codec name into 'imap4_utf_7' rather than
-'imap4-utf-7', and therefore the lookup function needs to account
-for the former name. Transform the latter locally to preserve support
-for all Python versions.
-
-Fixes: ticket: 9832
----
- src/twisted/mail/imap4.py | 2 +-
- 2 files changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/twisted/mail/imap4.py b/src/twisted/mail/imap4.py
-index 736ef111d..3f32982ca 100644
---- a/src/twisted/mail/imap4.py
-+++ b/src/twisted/mail/imap4.py
-@@ -6369,7 +6369,7 @@ _codecInfo = codecs.CodecInfo(encoder, decoder, StreamReader, StreamWriter)
-
-
- def imap4_utf_7(name):
-- if name == 'imap4-utf-7':
-+ if name.replace('-', '_') == 'imap4_utf_7':
- return _codecInfo
-
- codecs.register(imap4_utf_7)
---
-2.26.2
-
-From daf928bf0f0371816dddbd4929948c4213d0cdcb Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 27 May 2020 15:12:54 +0200
-Subject: [PATCH 3/4] Fix verifyCryptedPassword() for crypt.crypt() throwing in
- py3.9
-
-In Python 3.9, the crypt.crypt() function may throw an exception
-if the underlying crypt() function fails. Update
-verifyCryptedPassword() to account for that, and preserve the existing
-behavior of returning False in that case.
-
-Fixes: ticket:9833
----
- src/twisted/conch/checkers.py | 5 ++++-
- src/twisted/plugins/cred_unix.py | 5 ++++-
- 4 files changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/src/twisted/conch/checkers.py b/src/twisted/conch/checkers.py
-index 917567a39..e4e327b16 100644
---- a/src/twisted/conch/checkers.py
-+++ b/src/twisted/conch/checkers.py
-@@ -53,7 +53,10 @@ def verifyCryptedPassword(crypted, pw):
-
- @rtype: L{bool}
- """
-- return crypt.crypt(pw, crypted) == crypted
-+ try:
-+ return crypt.crypt(pw, crypted) == crypted
-+ except OSError:
-+ return False
-
-
-
-diff --git a/src/twisted/plugins/cred_unix.py b/src/twisted/plugins/cred_unix.py
-index 211b4ccbc..a662719b6 100644
---- a/src/twisted/plugins/cred_unix.py
-+++ b/src/twisted/plugins/cred_unix.py
-@@ -43,7 +43,10 @@ def verifyCryptedPassword(crypted, pw):
- pw = pw.decode('utf-8')
- if not isinstance(crypted, StringType):
- crypted = crypted.decode('utf-8')
-- return crypt.crypt(pw, crypted) == crypted
-+ try:
-+ return crypt.crypt(pw, crypted) == crypted
-+ except OSError:
-+ return False
-
-
-
---
-2.26.2
-
-From 4fc435df0d1eba3e5d6416a2b86d39d3404f82fe Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Wed, 27 May 2020 15:37:10 +0200
-Subject: [PATCH 4/4] Use xml.etree.ElementTree instead of deprecated
- cElementTree
-
-The xml.etree.cElementTree is deprecated, and has been removed in Python
-3.9. At the same time, xml.etree.ElementTree has already been using
-cElementTree implicitly since Python 3.3. Update test_flatten to use
-the latter to provide compatibility with newer Python versions.
-
-Fixes: ticket:9834
----
- src/twisted/web/test/test_flatten.py | 2 +-
- 2 files changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
-index 677401c55..61d50e20a 100644
---- a/src/twisted/web/test/test_flatten.py
-+++ b/src/twisted/web/test/test_flatten.py
-@@ -9,7 +9,7 @@ L{twisted.web._flatten}.
- import sys
- import traceback
-
--from xml.etree.cElementTree import XML
-+from xml.etree.ElementTree import XML
-
- from collections import OrderedDict
-
---
-2.26.2
-
diff --git a/dev-python/twisted/files/twisted-21.7.0-force-gtk3.patch b/dev-python/twisted/files/twisted-21.7.0-force-gtk3.patch
new file mode 100644
index 000000000000..a2e40559ec59
--- /dev/null
+++ b/dev-python/twisted/files/twisted-21.7.0-force-gtk3.patch
@@ -0,0 +1,67 @@
+From eec6b60116e12e015387fe1fa3a729553d3848bf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 22 May 2021 01:11:48 +0200
+Subject: [PATCH] Force using GTK+3 in twisted.internet.gireactor
+
+Modify twisted.internet.gireactor to explicitly request GTK+ version 3.
+Otherwise it uses the newest version installed which could be GTK+4
+that gireactor is currently incompatible with.
+---
+ src/twisted/internet/gireactor.py | 3 +++
+ src/twisted/internet/test/test_gireactor.py | 3 +++
+ src/twisted/newsfragments/10200.bugfix | 1 +
+ 3 files changed, 7 insertions(+)
+ create mode 100644 src/twisted/newsfragments/10200.bugfix
+
+diff --git a/src/twisted/internet/gireactor.py b/src/twisted/internet/gireactor.py
+index 92596db1d..a577825a8 100644
+--- a/src/twisted/internet/gireactor.py
++++ b/src/twisted/internet/gireactor.py
+@@ -24,6 +24,7 @@ On Python 3, pygobject v3.4 or later is required.
+ from twisted.internet.error import ReactorAlreadyRunning
+ from twisted.internet import _glibbase
+ from twisted.python import runtime
++import gi # type: ignore[import]
+ import gi.pygtkcompat # type: ignore[import]
+ from gi.repository import GLib # type: ignore[import]
+
+@@ -68,6 +69,7 @@ class GIReactor(_glibbase.GlibReactorBase):
+ def __init__(self, useGtk=False):
+ _gtk = None
+ if useGtk is True:
++ gi.require_version("Gtk", "3.0")
+ from gi.repository import Gtk as _gtk
+
+ _glibbase.GlibReactorBase.__init__(self, GLib, _gtk, useGtk=useGtk)
+@@ -112,6 +114,7 @@ class PortableGIReactor(_glibbase.PortableGlibReactorBase):
+ def __init__(self, useGtk=False):
+ _gtk = None
+ if useGtk is True:
++ gi.require_version("Gtk", "3.0")
+ from gi.repository import Gtk as _gtk
+
+ _glibbase.PortableGlibReactorBase.__init__(self, GLib, _gtk, useGtk=useGtk)
+diff --git a/src/twisted/internet/test/test_gireactor.py b/src/twisted/internet/test/test_gireactor.py
+index d15a92622..af5092a36 100644
+--- a/src/twisted/internet/test/test_gireactor.py
++++ b/src/twisted/internet/test/test_gireactor.py
+@@ -25,6 +25,9 @@ else:
+ gtk3reactor = None
+ else:
+ gtk3reactor = _gtk3reactor
++ import gi # type: ignore[import]
++
++ gi.require_version("Gtk", "3.0")
+ from gi.repository import Gtk
+
+ from twisted.internet.error import ReactorAlreadyRunning
+diff --git a/src/twisted/newsfragments/10200.bugfix b/src/twisted/newsfragments/10200.bugfix
+new file mode 100644
+index 000000000..7afb343be
+--- /dev/null
++++ b/src/twisted/newsfragments/10200.bugfix
+@@ -0,0 +1 @@
++twisted.internet.gireactor was fixed to force GTK+3 in order to fix use of incompatible GTK+4 API when installed
+--
+2.32.0
+