From caf0256e5f26bce5dc482ef07ba3bc1d7192c931 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 08:57:55 -0800
Subject: [PATCH 01/27] remove reference in comments to python3.6

---
 docker/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 2bdc607e66e6..6d3e88e25973 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -8,7 +8,7 @@
 # There is an optional PYTHON_VERSION build argument which sets the
 # version of python to build against: for example:
 #
-#    docker build -f docker/Dockerfile --build-arg PYTHON_VERSION=3.6 .
+#    docker build -f docker/Dockerfile --build-arg PYTHON_VERSION=3.7 .
 #
 
 ARG PYTHON_VERSION=3.8

From 0b34cde7db7d8a37def957693f4a7435aa5747a5 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 08:58:41 -0800
Subject: [PATCH 02/27] upgrade tox python env in script

---
 docker/run_pg_tests.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docker/run_pg_tests.sh b/docker/run_pg_tests.sh
index 58e2177d34c2..b22b6ef16b7e 100755
--- a/docker/run_pg_tests.sh
+++ b/docker/run_pg_tests.sh
@@ -16,4 +16,4 @@ sudo -u postgres /usr/lib/postgresql/10/bin/pg_ctl -w -D /var/lib/postgresql/dat
 # Run the tests
 cd /src
 export TRIAL_FLAGS="-j 4"
-tox --workdir=./.tox-pg-container -e py36-postgres "$@"
+tox --workdir=./.tox-pg-container -e py37-postgres "$@"

From 268b817f45909d82e0a7b58e51ea38f1b3264dc3 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 08:59:16 -0800
Subject: [PATCH 03/27] bump python version in example for completeness

---
 docs/admin_api/version_api.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/admin_api/version_api.md b/docs/admin_api/version_api.md
index efb4a0c0f7aa..27977de0d379 100644
--- a/docs/admin_api/version_api.md
+++ b/docs/admin_api/version_api.md
@@ -16,6 +16,6 @@ It returns a JSON body like the following:
 ```json
 {
     "server_version": "0.99.2rc1 (b=develop, abcdef123)",
-    "python_version": "3.6.8"
+    "python_version": "3.7.8"
 }
 ```

From acef726be155b031dc5724837ccd4288368e2b0a Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 09:00:03 -0800
Subject: [PATCH 04/27] upgrade python version requirement in setup doc

---
 docs/setup/installation.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/setup/installation.md b/docs/setup/installation.md
index 16562be95388..9c920c473383 100644
--- a/docs/setup/installation.md
+++ b/docs/setup/installation.md
@@ -194,7 +194,7 @@ When following this route please make sure that the [Platform-specific prerequis
 System requirements:
 
 - POSIX-compliant system (tested on Linux & OS X)
-- Python 3.6 or later, up to Python 3.9.
+- Python 3.7 or later, up to Python 3.10.
 - At least 1GB of free RAM if you want to join large public rooms like #matrix:matrix.org
 
 To install the Synapse homeserver run:

From 0add26224a545602b5df80e3d5776a630eb9349f Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 09:00:56 -0800
Subject: [PATCH 05/27] upgrade necessary python version in __init__.py

---
 synapse/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/synapse/__init__.py b/synapse/__init__.py
index 95a49c20befc..5f224d2e13d9 100644
--- a/synapse/__init__.py
+++ b/synapse/__init__.py
@@ -21,8 +21,8 @@
 import sys
 
 # Check that we're not running on an unsupported Python version.
-if sys.version_info < (3, 6):
-    print("Synapse requires Python 3.6 or above.")
+if sys.version_info < (3, 7):
+    print("Synapse requires Python 3.7 or above.")
     sys.exit(1)
 
 # Twisted and canonicaljson will fail to import when this file is executed to

From 1b98edbec625ce71823c16a8d7d12460babd3cd8 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 09:01:29 -0800
Subject: [PATCH 06/27] upgrade python version in setup.py

---
 setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index e618ff898b46..d0511c767f98 100755
--- a/setup.py
+++ b/setup.py
@@ -150,7 +150,7 @@ def exec_file(path_segments):
     zip_safe=False,
     long_description=long_description,
     long_description_content_type="text/x-rst",
-    python_requires="~=3.6",
+    python_requires="~=3.7",
     entry_points={
         "console_scripts": [
             "synapse_homeserver = synapse.app.homeserver:main",

From 52bd94f98962bca0bf3934ee2fef55a3062138bb Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 4 Jan 2022 09:14:47 -0800
Subject: [PATCH 07/27] newsfragment

---
 changelog.d/11683.misc | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 changelog.d/11683.misc

diff --git a/changelog.d/11683.misc b/changelog.d/11683.misc
new file mode 100644
index 000000000000..b1f048f7f52d
--- /dev/null
+++ b/changelog.d/11683.misc
@@ -0,0 +1 @@
+Drop support for Python 3.6, which is EOL.
\ No newline at end of file

From c74dcea144212f5b4f07c2ab8d7e12a7c06ea653 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 10:24:58 -0800
Subject: [PATCH 08/27] drops refs to bionic and replace with focal

---
 .ci/scripts/test_old_deps.sh | 2 +-
 .github/workflows/tests.yml  | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index 8b473936f8c3..3921df1890ea 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# this script is run by GitHub Actions in a plain `bionic` container; it installs the
+# this script is run by GitHub Actions in a plain `focal` container; it installs the
 # minimal requirements for tox and hands over to the py3-old tox environment.
 
 set -ex
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index cb72e1a233ec..4332aae99749 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -141,7 +141,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2
       - name: Test with old deps
-        uses: docker://ubuntu:bionic # For old python and sqlite
+        uses: docker://ubuntu:focal # For old python and sqlite
         with:
           workdir: /github/workspace
           entrypoint: .ci/scripts/test_old_deps.sh
@@ -213,15 +213,15 @@ jobs:
       fail-fast: false
       matrix:
         include:
-          - sytest-tag: bionic
+          - sytest-tag: focal
 
-          - sytest-tag: bionic
+          - sytest-tag: focal
             postgres: postgres
 
           - sytest-tag: testing
             postgres: postgres
 
-          - sytest-tag: bionic
+          - sytest-tag: focal
             postgres: multi-postgres
             workers: workers
 

From d717f1b4e2f2e44fbc2eed4f4a0672b3a1ade4a1 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 11:11:20 -0800
Subject: [PATCH 09/27] bump refs to postgres 9.6 to 10

---
 docker/Dockerfile-pgtests           | 2 +-
 docs/postgres.md                    | 2 +-
 synapse/storage/engines/postgres.py | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docker/Dockerfile-pgtests b/docker/Dockerfile-pgtests
index 92b804d1937f..b94484ea7fd6 100644
--- a/docker/Dockerfile-pgtests
+++ b/docker/Dockerfile-pgtests
@@ -1,6 +1,6 @@
 # Use the Sytest image that comes with a lot of the build dependencies
 # pre-installed
-FROM matrixdotorg/sytest:bionic
+FROM matrixdotorg/sytest:focal
 
 # The Sytest image doesn't come with python, so install that
 RUN apt-get update && apt-get -qq install -y python3 python3-dev python3-pip
diff --git a/docs/postgres.md b/docs/postgres.md
index e4861c1f127f..0562021da526 100644
--- a/docs/postgres.md
+++ b/docs/postgres.md
@@ -1,6 +1,6 @@
 # Using Postgres
 
-Synapse supports PostgreSQL versions 9.6 or later.
+Synapse supports PostgreSQL versions 10 or later.
 
 ## Install postgres client libraries
 
diff --git a/synapse/storage/engines/postgres.py b/synapse/storage/engines/postgres.py
index 30f948a0f77d..b3d71f661c03 100644
--- a/synapse/storage/engines/postgres.py
+++ b/synapse/storage/engines/postgres.py
@@ -46,8 +46,8 @@ def check_database(self, db_conn, allow_outdated_version: bool = False):
         self._version = db_conn.server_version
 
         # Are we on a supported PostgreSQL version?
-        if not allow_outdated_version and self._version < 90600:
-            raise RuntimeError("Synapse requires PostgreSQL 9.6 or above.")
+        if not allow_outdated_version and self._version < 100000:
+            raise RuntimeError("Synapse requires PostgreSQL 10 or above.")
 
         with db_conn.cursor() as txn:
             txn.execute("SHOW SERVER_ENCODING")

From b979f336afca42d4a686f2c4a3d8375c26711066 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 13:24:55 -0800
Subject: [PATCH 10/27] fix hanging ci

---
 docker/Dockerfile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 6d3e88e25973..3f714a850e54 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -12,6 +12,7 @@
 #
 
 ARG PYTHON_VERSION=3.8
+ARG DEBIAN_FRONTEND=noninteractive
 
 ###
 ### Stage 0: builder

From dd20fc12aa851d1e5a33d4284b45fe14ca23be0e Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 15:07:24 -0800
Subject: [PATCH 11/27] try installing tzdata first

---
 .ci/scripts/test_old_deps.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index 3921df1890ea..4a70200f4833 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -6,7 +6,7 @@
 set -ex
 
 apt-get update
-apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
+apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox tzdata
 
 export LANG="C.UTF-8"
 

From ebb53f45769f1fd4e452ad6156b53d48997dba69 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 15:08:05 -0800
Subject: [PATCH 12/27] revert change made in b979f336

---
 docker/Dockerfile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 3f714a850e54..6d3e88e25973 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -12,7 +12,6 @@
 #
 
 ARG PYTHON_VERSION=3.8
-ARG DEBIAN_FRONTEND=noninteractive
 
 ###
 ### Stage 0: builder

From 7496e3749a2196d0b6e8a15169be7c5de648a300 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 15:32:02 -0800
Subject: [PATCH 13/27] ignore new random mypy error while debugging other
 error

---
 tests/crypto/test_event_signing.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/crypto/test_event_signing.py b/tests/crypto/test_event_signing.py
index 1c920157f506..c831a2c0fcb1 100644
--- a/tests/crypto/test_event_signing.py
+++ b/tests/crypto/test_event_signing.py
@@ -36,8 +36,8 @@
 class EventSigningTestCase(unittest.TestCase):
     def setUp(self):
         self.signing_key = nacl.signing.SigningKey(SIGNING_KEY_SEED)
-        self.signing_key.alg = KEY_ALG
-        self.signing_key.version = KEY_VER
+        self.signing_key.alg = KEY_ALG # type: ignore
+        self.signing_key.version = KEY_VER # type: ignore
 
     def test_sign_minimal(self):
         event_dict = {

From b1566353a8fecd3aece7e579e60dc816579add58 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 15:43:35 -0800
Subject: [PATCH 14/27] fix lint error for temporary workaround

---
 tests/crypto/test_event_signing.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/crypto/test_event_signing.py b/tests/crypto/test_event_signing.py
index c831a2c0fcb1..15c4077c406b 100644
--- a/tests/crypto/test_event_signing.py
+++ b/tests/crypto/test_event_signing.py
@@ -36,8 +36,8 @@
 class EventSigningTestCase(unittest.TestCase):
     def setUp(self):
         self.signing_key = nacl.signing.SigningKey(SIGNING_KEY_SEED)
-        self.signing_key.alg = KEY_ALG # type: ignore
-        self.signing_key.version = KEY_VER # type: ignore
+        self.signing_key.alg = KEY_ALG  # type: ignore
+        self.signing_key.version = KEY_VER  # type: ignore
 
     def test_sign_minimal(self):
         event_dict = {

From 1ccaa28fa09b86a8ccf91ce6a53f34a35ffb98a5 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 16:11:08 -0800
Subject: [PATCH 15/27] revert change to install list

---
 .ci/scripts/test_old_deps.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index 4a70200f4833..3921df1890ea 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -6,7 +6,7 @@
 set -ex
 
 apt-get update
-apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox tzdata
+apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
 
 export LANG="C.UTF-8"
 

From c5e6dfa0a045a995a4875a19d85b1e1b26c854b5 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 16:13:37 -0800
Subject: [PATCH 16/27] try passing env var

---
 docker/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 6d3e88e25973..45a3a9ea1cb0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -66,7 +66,7 @@ LABEL org.opencontainers.image.documentation='https://github.com/matrix-org/syna
 LABEL org.opencontainers.image.source='https://github.com/matrix-org/synapse.git'
 LABEL org.opencontainers.image.licenses='Apache-2.0'
 
-RUN apt-get update && apt-get install -y \
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
     curl \
     gosu \
     libjpeg62-turbo \

From 997852465ed371e12e09f6966b0fba590b535d02 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 7 Jan 2022 17:29:49 -0800
Subject: [PATCH 17/27] export debian frontend var?

---
 .ci/scripts/test_old_deps.sh | 2 +-
 docker/Dockerfile            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index 3921df1890ea..77802ee3c154 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-
+export DEBIAN_FRONTEND=noninteractive
 # this script is run by GitHub Actions in a plain `focal` container; it installs the
 # minimal requirements for tox and hands over to the py3-old tox environment.
 
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 45a3a9ea1cb0..6d3e88e25973 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -66,7 +66,7 @@ LABEL org.opencontainers.image.documentation='https://github.com/matrix-org/syna
 LABEL org.opencontainers.image.source='https://github.com/matrix-org/synapse.git'
 LABEL org.opencontainers.image.licenses='Apache-2.0'
 
-RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
+RUN apt-get update && apt-get install -y \
     curl \
     gosu \
     libjpeg62-turbo \

From b38d9ea45aea5d83f3c17088eaa4d847ae063b3a Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Mon, 10 Jan 2022 08:39:54 -0800
Subject: [PATCH 18/27] move line and add comment

---
 .ci/scripts/test_old_deps.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index 77802ee3c154..21fd536d91ef 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -1,8 +1,10 @@
 #!/usr/bin/env bash
-export DEBIAN_FRONTEND=noninteractive
 # this script is run by GitHub Actions in a plain `focal` container; it installs the
 # minimal requirements for tox and hands over to the py3-old tox environment.
 
+# Prevent tzdata from asking for user input
+export DEBIAN_FRONTEND=noninteractive
+
 set -ex
 
 apt-get update

From f810705c924b5f6714a16919c18aa3085646de56 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Mon, 10 Jan 2022 08:40:16 -0800
Subject: [PATCH 19/27] bump pillow dependency

---
 synapse/python_dependencies.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index d844fbb3b3d6..cc6e4c61eaab 100644
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -70,7 +70,7 @@
     "pyasn1>=0.1.9",
     "pyasn1-modules>=0.0.7",
     "bcrypt>=3.1.0",
-    "pillow>=4.3.0",
+    "pillow>=5.4.0",
     "sortedcontainers>=1.4.4",
     "pymacaroons>=0.13.0",
     "msgpack>=0.5.2",

From 0a566a93ebe62ffa579834fcb01ca4f9e783db05 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Mon, 10 Jan 2022 10:37:29 -0800
Subject: [PATCH 20/27] bump lxml depenency

---
 synapse/python_dependencies.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index cc6e4c61eaab..22b4606ae0ea 100644
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -107,7 +107,7 @@
     # `systemd.journal.JournalHandler`, as is documented in
     # `contrib/systemd/log_config.yaml`.
     "systemd": ["systemd-python>=231"],
-    "url_preview": ["lxml>=3.5.0"],
+    "url_preview": ["lxml>=4.2.0"],
     "sentry": ["sentry-sdk>=0.7.2"],
     "opentracing": ["jaeger-client>=4.0.0", "opentracing>=2.2.0"],
     "jwt": ["pyjwt>=1.6.4"],

From efef6d4a4e1fd94917c726027b55fd53eb857f10 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Tue, 11 Jan 2022 13:27:46 -0800
Subject: [PATCH 21/27] install libjpeg-dev for pillow

---
 .ci/scripts/test_old_deps.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index 21fd536d91ef..bb23b124a534 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -8,7 +8,7 @@ export DEBIAN_FRONTEND=noninteractive
 set -ex
 
 apt-get update
-apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
+apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox libjpeg-dev
 
 export LANG="C.UTF-8"
 

From c5a9ad271c1bd9e2fd0f664250308f86c0827835 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Thu, 13 Jan 2022 14:05:18 -0800
Subject: [PATCH 22/27] bump automat version to one compatible with py3.8

---
 tox.ini | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tox.ini b/tox.ini
index 2ffca14b2278..32679e9106c8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -117,8 +117,7 @@ usedevelop=true
 skip_install = true
 usedevelop = false
 deps =
-    # Old automat version for Twisted
-    Automat == 0.3.0
+    Automat == 0.8.0
     lxml
     {[base]deps}
 

From 26d41fa130169d17fbba356bd19d101dd51ca9dd Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 14 Jan 2022 12:15:45 -0800
Subject: [PATCH 23/27] add libwebp for pillow

---
 .ci/scripts/test_old_deps.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/scripts/test_old_deps.sh b/.ci/scripts/test_old_deps.sh
index bb23b124a534..a54aa86fbc0f 100755
--- a/.ci/scripts/test_old_deps.sh
+++ b/.ci/scripts/test_old_deps.sh
@@ -8,7 +8,7 @@ export DEBIAN_FRONTEND=noninteractive
 set -ex
 
 apt-get update
-apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox libjpeg-dev
+apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox libjpeg-dev libwebp-dev
 
 export LANG="C.UTF-8"
 

From 8b695efe09e4ad91b088bfbeb9b146def80a6293 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Thu, 20 Jan 2022 08:09:58 -0800
Subject: [PATCH 24/27] bump twisted trunk python version

---
 .github/workflows/twisted_trunk.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/twisted_trunk.yml b/.github/workflows/twisted_trunk.yml
index e974ac7aba37..fb9d46b7bfdd 100644
--- a/.github/workflows/twisted_trunk.yml
+++ b/.github/workflows/twisted_trunk.yml
@@ -25,7 +25,7 @@ jobs:
       - run: sudo apt-get -qq install xmlsec1
       - uses: actions/setup-python@v2
         with:
-          python-version: 3.6
+          python-version: 3.7
       - run: .ci/patch_for_twisted_trunk.sh
       - run: pip install tox
       - run: tox -e py

From 954665d549f3c557a0456306e31de8da7c2bd057 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Thu, 20 Jan 2022 08:11:28 -0800
Subject: [PATCH 25/27] change suffix of newsfragment

---
 changelog.d/{11683.misc => 11683.removal} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename changelog.d/{11683.misc => 11683.removal} (100%)

diff --git a/changelog.d/11683.misc b/changelog.d/11683.removal
similarity index 100%
rename from changelog.d/11683.misc
rename to changelog.d/11683.removal

From 7aaa772e2523412e72d5b302ce576afcb09665a9 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 21 Jan 2022 13:48:22 -0800
Subject: [PATCH 26/27] remove redundant python 3.7 checks

---
 synapse/app/_base.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 579adbbca02d..f7d007431752 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -468,16 +468,12 @@ def run_sighup(*args: Any, **kwargs: Any) -> None:
     # everything currently allocated are things that will be used for the
     # rest of time. Doing so means less work each GC (hopefully).
     #
-    # This only works on Python 3.7
-    if platform.python_implementation() == "CPython" and sys.version_info >= (3, 7):
-        gc.collect()
-        gc.freeze()
+    gc.collect()
+    gc.freeze()
 
     # Speed up shutdowns by freezing all allocated objects. This moves everything
     # into the permanent generation and excludes them from the final GC.
-    # Unfortunately only works on Python 3.7
-    if platform.python_implementation() == "CPython" and sys.version_info >= (3, 7):
-        atexit.register(gc.freeze)
+    atexit.register(gc.freeze)
 
 
 def setup_sentry(hs: "HomeServer") -> None:

From 8d209b22abfa530bed24fa813137750ba33dbca8 Mon Sep 17 00:00:00 2001
From: "H. Shay" <hillerys@element.io>
Date: Fri, 21 Jan 2022 13:55:54 -0800
Subject: [PATCH 27/27] lint

---
 synapse/app/_base.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index f7d007431752..e5ee03b79ff9 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -16,7 +16,6 @@
 import gc
 import logging
 import os
-import platform
 import signal
 import socket
 import sys