gh-141510: Fix copy.deepcopy() for recursive frozendict#145027
gh-141510: Fix copy.deepcopy() for recursive frozendict#145027vstinner wants to merge 4 commits intopython:mainfrom
Conversation
|
After adding the pickle support we may be able to remove the special deepcopy code. |
|
I added the tests requested by @serhiy-storchaka. |
I propose merging #144967 PR first (once it will be approved), and then rework this PR. See also @serhiy-storchaka's comment on the pickle PR:
We can add more tests in this deepcopy PR. |
I merged main into this branch to retrieve the pickle change. If I remove |
Hmm, I thought it is just an optimization. I wonder if |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM. 👍 (But maybe add few more assertions?)
| x['foo'].append(x) | ||
| x = x['foo'] | ||
| y = copy.deepcopy(x) | ||
| self.assertIs(y[0]['foo'], y) |
There was a problem hiding this comment.
Add also other assertions similar to the above ones:
self.assertEqual(y, x)
self.assertIsNot(x, y)
self.assertIsNot(x[0], y[0])There was a problem hiding this comment.
self.assertEqual(y, x) fails with RecursionError. I added the two other tests.
Uh oh!
There was an error while loading. Please reload this page.