From f92e68c30a0d38d25486e3f3cfabe5dfb5961ef7 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Wed, 13 Sep 2023 15:49:10 +0100 Subject: Fixed #34822 -- Added support for serializing functions decorated with functools.lru_cache in migrations. `@functools.cache` and `@functools.lru_cache` return an object of type `functools._lru_cache_wrapper` which prevented the migrations serializer from working. Simply using the existing `FunctionTypeSerializer` for this additional type works as expected. --- django/db/migrations/serializer.py | 1 + 1 file changed, 1 insertion(+) (limited to 'django') diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py index 06657ebaab..69e10fd41b 100644 --- a/django/db/migrations/serializer.py +++ b/django/db/migrations/serializer.py @@ -350,6 +350,7 @@ class Serializer: types.FunctionType, types.BuiltinFunctionType, types.MethodType, + functools._lru_cache_wrapper, ): FunctionTypeSerializer, collections.abc.Iterable: IterableSerializer, (COMPILED_REGEX_TYPE, RegexObject): RegexSerializer, -- cgit v1.3