diff options
author | Pieter Eendebak <pieter.eendebak@gmail.com> | 2023-09-29 09:28:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 10:28:01 +0300 |
commit | 05079d93e410fca1e41ed32e67c54d63cbd9b35b (patch) | |
tree | 523843106445b237a59e60c2b6073ce855b7a0a4 /Lib/copy.py | |
parent | 7dc2c5093ef027aab57bca953ac2d6477a4a440b (diff) | |
download | cpython-05079d93e410fca1e41ed32e67c54d63cbd9b35b.tar.gz cpython-05079d93e410fca1e41ed32e67c54d63cbd9b35b.zip |
gh-109868: Skip deepcopy memo check for empty memo (GH-109869)
Diffstat (limited to 'Lib/copy.py')
-rw-r--r-- | Lib/copy.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/copy.py b/Lib/copy.py index 6d7bb9a111b..a69bc4e78c2 100644 --- a/Lib/copy.py +++ b/Lib/copy.py @@ -121,13 +121,13 @@ def deepcopy(x, memo=None, _nil=[]): See the module's __doc__ string for more info. """ + d = id(x) if memo is None: memo = {} - - d = id(x) - y = memo.get(d, _nil) - if y is not _nil: - return y + else: + y = memo.get(d, _nil) + if y is not _nil: + return y cls = type(x) |