You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Python 3.11, objects have a __getstate__ method by default:
python/cpython#70766
Therefore, the exception in BaseEstimator.__getstate__ will no longer be
raised, thus not falling back on using the object's __dict__:
https://github.com/scikit-learn/scikit-learn/blob/dc580a8ef5ee2a8aea80498388690e2213118efd/sklearn/base.py#L274-L280
If the instance dict of the object is empty, the return value will,
however, be None. Therefore, the line below calling state.items()
results in an error.
In this bugfix, it is checked if the state is None and if it is, the
object's __dict__ is used (which should always be empty).
Not addressed in this PR is how to deal with slots (see also discussion
in scikit-learn#10079). When there are __slots__, __getstate__ will actually return
a tuple, as documented here:
https://docs.python.org/3/library/pickle.html#object.__getstate__
The user would thus still get an indiscriptive error message.
0 commit comments