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

Commit

Permalink
synapse.app.base: only call gc.freeze() on CPython
Browse files Browse the repository at this point in the history
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 <intelfx@intelfx.name>
  • Loading branch information
intelfx committed Jan 30, 2021
1 parent ca39247 commit 2884a7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog.d/9270.misc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Restore PyPy compatibility by using psycopg2cffi consistently.
Restore PyPy compatibility by using psycopg2cffi consistently and not calling CPython GC methods.
3 changes: 2 additions & 1 deletion synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import gc
import logging
import os
import platform
import signal
import socket
import sys
Expand Down Expand Up @@ -339,7 +340,7 @@ def run_sighup(*args, **kwargs):
# rest of time. Doing so means less work each GC (hopefully).
#
# This only works on Python 3.7
if sys.version_info >= (3, 7):
if platform.python_implementation() == "CPython" and sys.version_info >= (3, 7):
gc.collect()
gc.freeze()

Expand Down

0 comments on commit 2884a7f

Please sign in to comment.