Skip to content

Commit

Permalink
Adjust recursion limit for deep copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jun 11, 2024
1 parent 859ae41 commit 94ff183
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion order/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
]


import sys
import re
import copy
import collections
Expand Down Expand Up @@ -294,7 +295,12 @@ def copy(self, *args, **kwargs):
setattr(self, spec.src, ref_placeholder)

# perform the deep copy operation
inst = copy.deepcopy(self)
orig_rec_limit = sys.getrecursionlimit()
try:
sys.setrecursionlimit(max(orig_rec_limit, 10000))
inst = copy.deepcopy(self)
finally:
sys.setrecursionlimit(orig_rec_limit)

# reset skipped attributes
for spec, obj in skips.items():
Expand Down
2 changes: 1 addition & 1 deletion order/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class typed(property):
.. code-block:: python
class MyClass(object):
class MyClass(object):
def __init__(self):
self._foo = None
Expand Down

0 comments on commit 94ff183

Please sign in to comment.