Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Drop patch for reference cycles in Gzip (#17610)

Filip Owczarek4c3486ff418a
diff --git a/saleor/patch_gzip.py b/saleor/patch_gzip.py
deleted file mode 100644
index 69fd007775..0000000000
--- a/saleor/patch_gzip.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from gzip import _WriteBufferStream # type: ignore[attr-defined]
-
-
-def __del_tmp__(self):
- del self.gzip_file
-
-
-def patch_gzip():
- """Patch `__del__` in `_WriteBufferStream` from `gzip` to avoid memory leaks.
-
- Those changes will remove the circular references in `GzipFile`, allowing memory to be freed immediately,
- without the need of a deep garbage collection cycle.
- Cycle: `GzipFile._buffer` -> `BufferedWriter._raw` -> `_WriteBufferStream.gzip_file` -> `GzipFile`.
- Issue: https://github.com/python/cpython/issues/129640
- """
- _WriteBufferStream.__del__ = __del_tmp__
diff --git a/saleor/settings.py b/saleor/settings.py
index 0e59dfa055..877a951c24 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -34,7 +34,6 @@ from .core.languages import LANGUAGES as CORE_LANGUAGES
from .core.schedules import initiated_promotion_webhook_schedule
from .graphql.executor import patch_executor
from .graphql.promise import patch_promise
-from .patch_gzip import patch_gzip
from .patch_local import patch_local
django_stubs_ext.monkeypatch()
@@ -1068,10 +1067,6 @@ i18n_rules_override()
# immediately, without the need of a deep garbage collection cycle.
patch_promise()
-# Patch `_WriteBufferStream` from `gizip` to remove all references that could result in reference cycles,
-# allowing memory to be freed immediately, without the need of a deep garbage collection cycle.
-patch_gzip()
-
# Patch `DatabaseClient`, `DatabaseCreation`, `DatabaseFeatures`, `DatabaseIntrospection`, `DatabaseOperations`,
# `BaseDatabaseValidation` and `DatabaseErrorWrapper` to remove all references that could result in reference cycles,
# allowing memory to be freed immediately, without the need of a deep garbage collection cycle.