Skip to content

Fix deepcopying on Python 3.11

Michael Kuron requested to merge py311 into master

Python 3.11 added object.__setstate__ (https://github.com/python/cpython/commit/884eba3c76916889fd6bff3b37b8552bfb4f9566), which breaks our fix for #40 (closed), but only on Sympy version 1.11 because that version added sympy.Basic.__setstate__ (https://github.com/sympy/sympy/commit/24e1e1a2ea4e3952c577d36138f31780b7548512). The updated fix is actually more logical (because it actually does what the comment says), so hopefully it will survive future version updates better.

This fixes both the AttributeError: 'tuple' object has no attribute 'items' issue which we already have a fix for in !327 (closed), and the sp.Pow issue that came up next.

Tested with Python 3.10 and 3.11 and Sympy 1.9 and 1.11.

@holzer, you'll need to merge manually because of builds failing due to !327 (closed).

Edited by Michael Kuron

Merge request reports