Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picking wrapped classes #117

Open
rabernat opened this issue Aug 26, 2023 · 1 comment
Open

Picking wrapped classes #117

rabernat opened this issue Aug 26, 2023 · 1 comment

Comments

@rabernat
Copy link

Thanks for this very useful package! It solves a genuine problem with python's "all or nothing" approach to async programming.

I noticed that the classes produced by Synchronizer.create_blocking are not pickleable, even if the classes they wrap are.

I then had a look at the tests and saw this comment:

@pytest.mark.skip(reason="Let's revisit this in 0.2.0")
def test_pickle():
s = Synchronizer()
BlockingPicklableClass = s.create(PicklableClass, Interface.BLOCKING)
obj = BlockingPicklableClass()
assert obj.f(42) == 1764
data = pickle.dumps(obj)
obj2 = pickle.loads(data)
assert obj2.f(43) == 1849

This makes me think there is some history here...

If I wanted to make my wrapped classes pickleable, could you give me any pointers on where to start?

@erikbern
Copy link
Collaborator

honestly, i don't remember – i just tried to run the test again and it fails in some very opaque way :(

synchronicity is overdue for a refactoring – i think it would be good to revisit things like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants