Skip to content

Treat __setstate__ as constructor#311

Merged
mristin merged 1 commit intomasterfrom
mristin/Support-pickling
Jan 29, 2026
Merged

Treat __setstate__ as constructor#311
mristin merged 1 commit intomasterfrom
mristin/Support-pickling

Conversation

@mristin
Copy link
Collaborator

@mristin mristin commented Jan 29, 2026

We change the decoration logic such that the call to __setstate__, a dunder method used during unpickling (i.e., loading with pickle module), is handled as a constructor. This means that the invariants are not checked before and during the call to __setstate__, but only after the call.

We change the decoration logic such that the call to ``__setstate__``, a
dunder method used during unpickling (*i.e.*, loading with ``pickle``
module), is handled as a constructor. This means that the invariants are
not checked before and during the call to ``__setstate__``, but only
after the call.
@mristin mristin merged commit beb4199 into master Jan 29, 2026
13 checks passed
@mristin mristin deleted the mristin/Support-pickling branch January 29, 2026 12:20
@coveralls
Copy link

Coverage Status

coverage: 91.626% (+0.05%) from 91.579%
when pulling b7c8749 on mristin/Support-pickling
into deadc55 on master.

mristin added a commit that referenced this pull request Jan 29, 2026
* Treat ``__setstate__`` as constructor (#311)

This is a patch release so that we can enable unpickling of class
instances where some of the attributes are not pickled and only restored
in ``__setstate__``.
@mristin mristin mentioned this pull request Jan 29, 2026
mristin added a commit that referenced this pull request Jan 29, 2026
* Treat ``__setstate__`` as constructor (#311)

This is a patch release so that we can enable unpickling of class
instances where some of the attributes are not pickled and only restored
in ``__setstate__``.
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

Successfully merging this pull request may close these issues.

2 participants