Browse Source

ref: remove pickle monkeypatch but temporarily maintain the functions (#60718)

some pickles have references to these functions despite them being
unused

these are picked up by django's `__reduce__` implementation


originally attempted in #60706
anthony sottile 1 year ago
parent
commit
8648d44858
1 changed files with 0 additions and 13 deletions
  1. 0 13
      src/sentry/runner/initializer.py

+ 0 - 13
src/sentry/runner/initializer.py

@@ -367,8 +367,6 @@ def initialize_app(config: dict[str, Any], skip_service_validation: bool = False
 
     monkeypatch_drf_listfield_serializer_errors()
 
-    monkeypatch_model_unpickle()
-
     import django
 
     django.setup()
@@ -491,17 +489,6 @@ def __simple_class_factory_compat(model: T, attrs: Any) -> T:
     return model
 
 
-def monkeypatch_model_unpickle() -> None:
-    # https://code.djangoproject.com/ticket/27187
-    # Django 1.10 breaks pickle compat with 1.9 models.
-    django.db.models.base.model_unpickle = __model_unpickle_compat
-
-    # Django 1.10 needs this to unpickle 1.9 models, but we can't branch while
-    # monkeypatching else our monkeypatched funcs won't be pickleable.
-    # So just vendor simple_class_factory from 1.9.
-    django.db.models.base.simple_class_factory = __simple_class_factory_compat
-
-
 def monkeypatch_django_migrations() -> None:
     # This monkeypatches django's migration executor with our own, which
     # adds some small but important customizations.