From 17208bb60bc8ffe130febb39a09d801aaff00169 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 16 May 2022 12:07:10 +0100 Subject: [PATCH] fix(polys): fix pickling of poly objects for Python 3.11 This is needed after the changes in https://github.com/python/cpython/issues/70766 Since object now has a __getstate__ method we need to make sure not to call it with any arguments. Probably the __getstate__ methods can be simplified (or removed?) in light of the cpython changes but for now this is a quick fix to restore previous behaviour. --- sympy/polys/polyutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sympy/polys/polyutils.py b/sympy/polys/polyutils.py index 6e70a5572f73..d03b2923307b 100644 --- a/sympy/polys/polyutils.py +++ b/sympy/polys/polyutils.py @@ -470,7 +470,7 @@ def __getstate__(self, cls=None): # Get all data that should be stored from super classes for c in cls.__bases__: - if hasattr(c, "__getstate__"): + if c is not object and hasattr(c, "__getstate__"): d.update(c.__getstate__(self, c)) # Get all information that should be stored from cls and return the dict