| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Good catch!
Sorry, something went wrong.
|
After adding the pickle support we may be able to remove the special deepcopy code. |
Sorry, something went wrong.
|
I added the tests requested by @serhiy-storchaka. |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
I merged main into this branch to retrieve the pickle change. If I remove _deepcopy_frozendict(), test_copy.test_deepcopy_frozendict() fails: FAIL: test_deepcopy_frozendict (test.test_copy.TestCopy.test_deepcopy_frozendict)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/python/main/Lib/test/test_copy.py", line 442, in test_deepcopy_frozendict
self.assertIs(y['foo'][0], y)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: frozendict({'foo': [frozendict({...})]}) is not frozendict({'foo': [frozendict({'foo': [...]})]})
|
Sorry, something went wrong.
Hmm, I thought it is just an optimization. I wonder if deepcopy() can be generalized to handle this. But this is a different issue. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. 👍 (But maybe add few more assertions?)
Sorry, something went wrong.
| 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])
Sorry, something went wrong.
There was a problem hiding this comment.
self.assertEqual(y, x) fails with RecursionError. I added the two other tests.
Sorry, something went wrong.
|
Merged, thanks for the exhaustive review. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.