mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
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.
This commit is contained in:
parent
c131949e3e
commit
f92e68c30a
4 changed files with 23 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue