-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
threading.local global variable in _make.py breaks (cloud)pickling #754
Comments
This is a duplicate of #458 and my thoughts on it are in #458 (comment). So far the cloudpickle team hasn't reached out to us. |
Thanks for the context @hynek ! Are you familiar enough with While I would agree that |
Let's move any discussion to #358 so it's all in one place. |
I mean #358 is closed, so… :D But I don not have any thoughts...if anybody has any ideas how to implement this without compromising the current behavior (aka the tests still pass), our PRs are open as the kids nowadays say. :) |
This issue is open and has essentially the same repro as in my report: #458 |
I was trying to use
cloudpickle
andattrs
-based object and ran into a really weird issue where cloudpickle found a threading.local that obviously can't be pickled. When I instrumented the pickle and cloudpickle source code in my container, I found the issue traces back to the_already_repring
global threading.local object in_make.py
:https://github.com/python-attrs/attrs/blame/efcbae51cd8053c193055618cc8a6ac7880ef062/src/attr/_make.py#L1744
Here is a minimal example that shows the error:
And here is a notebook where you can see the crash (at the time of writing): https://colab.research.google.com/drive/1WK4EqzWyNQ3PFNSopXk-Y32IQXi8hHL9?usp=sharing
Screenshot of the error:
I believe
pickle
for anattrs
-based object probably works, though, since I've done that with previous versions ofattrs
...Can we get rid of this global variable
_already_repring
? The addition of it seems to address a rather odd use case ( 5e46afd ). Perhaps_already_repring
could be initialized on first invocation of_make_repr()
(e.g. turn_make_repr()
into a callable object that creates_already_repring
on__call__
) rather than initialized like this at package load time. (Removing globals is probably a good thing here anyways?)The text was updated successfully, but these errors were encountered: