summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2023-09-13 15:49:10 +0100
committerNatalia <124304+nessita@users.noreply.github.com>2023-09-13 15:57:18 -0300
commitf92e68c30a0d38d25486e3f3cfabe5dfb5961ef7 (patch)
tree50e5828121b673e1eb661d774c89f92b7ef86584 /django
parentc131949e3ebd3b54ee6d4c11239401a215e5cb9b (diff)
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.
Diffstat (limited to 'django')
-rw-r--r--django/db/migrations/serializer.py1
1 files changed, 1 insertions, 0 deletions
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,