ets-labs / python-dependency-injector

Dependency injection framework for Python
https://python-dependency-injector.ets-labs.org/
BSD 3-Clause "New" or "Revised" License
3.99k stars 305 forks source link

RecursionError: maximum recursion depth exceeded while calling a Python object #811

Open AlexandrIllarionov opened 3 months ago

AlexandrIllarionov commented 3 months ago

File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy y = copier(x, memo) ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 153, in deepcopy y = copier(memo) ^^^^^^^^^^^^ File "src/dependency_injector/providers.pyx", line 1046, in dependency_injector.providers.DependenciesContainer.deepcopy File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy y = copier(x, memo) ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 153, in deepcopy y = copier(memo) ^^^^^^^^^^^^ File "src/dependency_injector/providers.pyx", line 790, in dependency_injector.providers.Dependency.deepcopy RecursionError: maximum recursion depth exceeded while calling a Python object Exception ignored in: 'dependency_injector.providers.Provider._copy_overridings' Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy y = copier(x, memo) ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 153, in deepcopy y = copier(memo) ^^^^^^^^^^^^ File "src/dependency_injector/providers.pyx", line 1046, in dependency_injector.providers.DependenciesContainer.deepcopy File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy y = copier(x, memo) ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 231, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 153, in deepcopy y = copier(memo) ^^^^^^^^^^^^ File "src/dependency_injector/providers.pyx", line 790, in dependency_injector.providers.Dependency.deepcopy RecursionError: maximum recursion depth exceeded while calling a Python object Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple File "/usr/lib/python3.11/copy.py", line 211, in RecursionError: maximum recursion depth exceeded Exception ignored in: 'dependency_injector.providers.Provider._copy_overridings' Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple File "/usr/lib/python3.11/copy.py", line 211, in RecursionError: maximum recursion depth exceeded Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple File "/usr/lib/python3.11/copy.py", line 211, in RecursionError: maximum recursion depth exceeded Exception ignored in: 'dependency_injector.providers.Provider._copy_overridings' Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple File "/usr/lib/python3.11/copy.py", line 211, in RecursionError: maximum recursion depth exceeded Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple File "/usr/lib/python3.11/copy.py", line 211, in RecursionError: maximum recursion depth exceeded Exception ignored in: 'dependency_injector.providers.Provider._copy_overridings' Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple File "/usr/lib/python3.11/copy.py", line 211, in RecursionError: maximum recursion depth exceeded Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy y = copier(x, memo) ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 153, in deepcopy y = copier(memo) ^^^^^^^^^^^^ File "src/dependency_injector/providers.pyx", line 1044, in dependency_injector.providers.DependenciesContainer.deepcopy File "src/dependency_injector/providers.pyx", line 5051, in dependency_injector.providers._memorized_duplicate File "src/dependency_injector/providers.pyx", line 1034, in dependency_injector.providers.DependenciesContainer.init File "src/dependency_injector/providers.pyx", line 461, in dependency_injector.providers.Object.init File "src/dependency_injector/providers.pyx", line 211, in dependency_injector.providers.Provider.init RecursionError: maximum recursion depth exceeded while calling a Python object Exception ignored in: 'dependency_injector.providers.Provider._copy_overridings' Traceback (most recent call last): File "src/dependency_injector/providers.pyx", line 4920, in dependency_injector.providers.deepcopy File "/usr/lib/python3.11/copy.py", line 146, in deepcopy y = copier(x, memo) ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in _deepcopy_tuple y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 211, in y = [deepcopy(a, memo) for a in x] ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/copy.py", line 153, in deepcopy y = copier(memo) ^^^^^^^^^^^^ File "src/dependency_injector/providers.pyx", line 1044, in dependency_injector.providers.DependenciesContainer.deepcopy File "src/dependency_injector/providers.pyx", line 5051, in dependency_injector.providers._memorized_duplicate File "src/dependency_injector/providers.pyx", line 1034, in dependency_injector.providers.DependenciesContainer.init File "src/dependency_injector/providers.pyx", line 461, in dependency_injector.providers.Object.init File "src/dependency_injector/providers.pyx", line 211, in dependency_injector.providers.Provider.init RecursionError: maximum recursion depth exceeded while calling a Python object

rmk135 commented 3 months ago

Can you please post the code that causes this error?

AlexandrIllarionov commented 3 months ago

It s just huge amount of containers. Fixed temporarily by increasing sys.setrecursionlimit(2500)