Skip to content

Commit

Permalink
Update cloudpickle/cloudpickle.py
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier Grisel <[email protected]>
  • Loading branch information
pierreglaser and ogrisel authored Oct 11, 2024
1 parent eba5848 commit 4ad41f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cloudpickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,11 @@ def _class_setstate(obj, state):
if sys.version_info >= (3, 13) and "__firstlineno__" in state:
# Set the Python 3.13+ only __firstlineno__ attribute one more time, as it
# will be automatically deleted by the `setattr(obj, attrname, attr)` call
# above when `attrname` is "__firstlineno__".
# above when `attrname` is "__firstlineno__". We assume that preserving this
# information might be important for some users and that it not stale in the
# context of cloudpickle usage, hence legitimate to propagate. Furthermore it
# is necessary to do so to keep deterministic chained pickling as tested in
# test_deterministic_str_interning_for_chained_dynamic_class_pickling.
obj.__firstlineno__ = state["__firstlineno__"]

if registry is not None:
Expand Down

0 comments on commit 4ad41f6

Please sign in to comment.