question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvokeViaAttributeShortcut makes it impossible to pickle objects

See original GitHub issue

Issue 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:closed
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
gasmancommented, Aug 11, 2022

Fixed in #6411

1reaction
ababiccommented, Sep 27, 2020

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found