Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python: Fix pickling support for Python 3.11
The addition of object.__getstate__ in Python 3.11(*) broke logic in the pickling support code that assumed that __getstate__ would only exist on a wrapped class if it were explicitly provided. Under 3.11+, this code now ignores __getstate__ if it came from object and not the class itself. This maintains behavior prior to Python 3.11 when pickling instances with attributes added directly to their __dict__. A new test case was added to pickle1 to exercise this behavior. This also fixes other failures in pickle1 and pickle4 where __reduce__ would otherwise include an unexpected "None" entry in the tuple it returns. (*) https://docs.python.org/3/whatsnew/3.11.html#other-language-changes Fixes #3384 (Internal change: 2351569)
- Loading branch information