spoiler: it does
Last active
March 28, 2020 21:31
-
-
Save laundmo/830ed51437ed05cbf9df5ba3bff5fc30 to your computer and use it in GitHub Desktop.
test for pickle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide2.QtWidgets import QGraphicsItem | |
import pickle | |
class Test(QGraphicsItem): | |
def __init__(self): | |
self.a = 1 | |
def __setstate__(self, state): | |
self.a = state["a"] | |
def __getstate__(self): | |
return {"a":self.a} | |
t = Test() | |
pickle_string = pickle.dumps(t) | |
print("pickled") | |
b = pickle.loads(pickle_string) | |
print(b.a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment