Repository navigation
Preserve abstract properties when pickling - #630
Open
nithishreddy5771 wants to merge 3 commits into
Open
nithishreddy5771 wants to merge 3 commits into
nithishreddy5771 wants to merge 3 commits into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The property reducer is registered for both
propertyandabc.abstractproperty, but always reconstructs a plainproperty. This loses the legacy descriptor's abstract flag.After a by-value round trip, the base class retains its saved abstract-method set. However, a new subclass recomputes that set from the now-concrete property and can be instantiated without implementing it, executing the abstract placeholder instead.
Reconstruct the descriptor with
type(obj), as the neighboring class/static-method reducer already does. Add isolated regressions across protocols 0-5 for descriptor type, abstractness, documentation, getter/setter/deleter behavior, incomplete subclasses and valid concrete subclasses. Ordinary properties and the modern@propertyplus@abstractmethodform are controls.abc.abstractpropertyis deprecated but explicitly supported by cloudpickle. This is a small legacy-path correctness fix; the modern form already works.Validation
git diff --checkpasses.Checks ran on Linux with compatible dependencies from the development requirements, not a lock file. Other Python versions, PyPy, Windows/macOS and downstream integrations were not tested. No production incident or coverage percentage is claimed.
Implemented and tested by an AI assistant on my behalf. Separate automated validation covered Python 3.10; no human code review is claimed.