InvokeViaAttributeShortcut makes it impossible to pickle objects
See original GitHub issueIssue Summary
wagtail.core.utils.InvokeViaAttributeShortcut
makes it impossible to pickle BaseSetting
object.
So it effectively kills object level caching.
Steps to Reproduce
import pickle
some_settings_obj = SomeSettings.objects.get(pk=1)
picke.dumps(some_settings_obj, -1)
would produce TypeError: 'str' object is not callable
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Establishing why an object can't be pickled - Stack Overflow
I would use dill , which has tools to investigate what inside an object causes your target object to not be picklable. See...
Read more >pickle — Python object serialization — Python 3.11.1 ...
It is possible to construct malicious pickle data which will execute arbitrary code during unpickling. Never unpickle data that could have come from...
Read more >Issue #116 | This Week in Wagtail
How you can make content soar with Wagtail 4.0 ... Fix #6408: InvokeViaAttributeShortcut makes it impossible to pickle objects ...
Read more >The Python pickle Module: How to Persist Objects in Python
In this tutorial, you'll learn how you can use the Python pickle module to convert your objects into a stream of bytes that...
Read more >Do Not Use Python Pickle Unless You Know All These Points
Pickle constructs arbitrary Python objects by invoking arbitrary functions, that's why it is not secure. However, this enables it to serialise ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in #6411
@pySilver it’s just psueodo code - I don’t have my laptop on me.
If the code you added is indeed required to make slots work, then using slots is not really benefiting us much. Any memory gains would just be cancelled out by the creation of the dict in
__getstate__
. I would rather just drop the__slots__
in that case.