summaryrefslogtreecommitdiff
path: root/docs
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 /docs
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 'docs')
-rw-r--r--docs/releases/5.0.txt4
-rw-r--r--docs/topics/migrations.txt7
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt
index 3bcec805ef..ec80ac6434 100644
--- a/docs/releases/5.0.txt
+++ b/docs/releases/5.0.txt
@@ -401,7 +401,9 @@ Management Commands
Migrations
~~~~~~~~~~
-* ...
+* Serialization of functions decorated with :func:`functools.cache` or
+ :func:`functools.lru_cache` is now supported without the need to write a
+ custom serializer.
Models
~~~~~~
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt
index 08d458fbb8..b7cd7043c2 100644
--- a/docs/topics/migrations.txt
+++ b/docs/topics/migrations.txt
@@ -788,6 +788,8 @@ Django can serialize the following:
- Functions may be decorated if wrapped properly, i.e. using
:func:`functools.wraps`
+ - The :func:`functools.cache` and :func:`functools.lru_cache` decorators are
+ explicitly supported
- Unbound methods used from within the class body
- Any class reference (must be in module's top-level scope)
@@ -797,6 +799,11 @@ Django can serialize the following:
Serialization support for ``enum.Flag`` was added.
+.. versionchanged:: 5.0
+
+ Serialization support for functions decorated with :func:`functools.cache`
+ or :func:`functools.lru_cache` was added.
+
Django cannot serialize:
- Nested classes