Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 2884a7f

Browse files
committed
synapse.app.base: only call gc.freeze() on CPython
gc.freeze() is an implementation detail of CPython garbage collector, and notably does not exist on PyPy. Rather than playing whack-a-mole and skipping the call when under PyPy, simply restrict it to CPython because the whole gc module is implementation-defined. Signed-off-by: Ivan Shapovalov <[email protected]>
1 parent ca39247 commit 2884a7f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog.d/9270.misc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Restore PyPy compatibility by using psycopg2cffi consistently.
1+
Restore PyPy compatibility by using psycopg2cffi consistently and not calling CPython GC methods.

synapse/app/_base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import gc
1717
import logging
1818
import os
19+
import platform
1920
import signal
2021
import socket
2122
import sys
@@ -339,7 +340,7 @@ def run_sighup(*args, **kwargs):
339340
# rest of time. Doing so means less work each GC (hopefully).
340341
#
341342
# This only works on Python 3.7
342-
if sys.version_info >= (3, 7):
343+
if platform.python_implementation() == "CPython" and sys.version_info >= (3, 7):
343344
gc.collect()
344345
gc.freeze()
345346

0 commit comments

Comments
 (0)