You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Maximum recursion depth exceeded in __getattr__(). #103272
We're hitting RecursionError: maximum recursion depth exceeded in Django test suite with Python 3.12.0a7 when accessing an attribute with a custom __getattr__() method:
ERROR: test_access_warning (deprecation.test_storages.DefaultStorageDeprecationTests.test_access_warning)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/django/tests/deprecation/test_storages.py", line 128, in test_access_warning
settings.DEFAULT_FILE_STORAGE
File "/django/django/conf/__init__.py", line 83, in __getattr__
if (_wrapped := self._wrapped) is empty:
^^^^^^^^^^^^^
File "/django/django/conf/__init__.py", line 83, in __getattr__
if (_wrapped := self._wrapped) is empty:
^^^^^^^^^^^^^
File "/django/django/conf/__init__.py", line 83, in __getattr__
if (_wrapped := self._wrapped) is empty:
^^^^^^^^^^^^^
[Previous line repeated 790 more times]
RecursionError: maximum recursion depth exceeded
NB: when running this test with debug build, it crashes.
Testing against Django installed in '/home/ubuntu/django-main/django' with up to 8 processes
Found 6 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
.python: Python/ceval.c:821: _PyEval_EvalFrameDefault: Assertion `!_PyErr_Occurred(tstate)' failed.
Fatal Python error: Aborted
Current thread 0x00007f2f2750e740 (most recent call first):
File "/home/ubuntu/django-main/django/conf/__init__.py", line 81 in __getattr__
File "/home/ubuntu/django-main/tests/deprecation/test_storages.py", line 128 in test_access_warning
File "/home/ubuntu/cpython-main/Lib/unittest/case.py", line 589 in _callTestMethod
File "/home/ubuntu/cpython-main/Lib/unittest/case.py", line 634 in run
File "/home/ubuntu/cpython-main/Lib/unittest/case.py", line 690 in __call__
File "/home/ubuntu/django-main/django/test/testcases.py", line 292 in _setup_and_call
File "/home/ubuntu/django-main/django/test/testcases.py", line 257 in __call__
File "/home/ubuntu/cpython-main/Lib/unittest/suite.py", line 122 in run
File "/home/ubuntu/cpython-main/Lib/unittest/suite.py", line 84 in __call__
File "/home/ubuntu/cpython-main/Lib/unittest/runner.py", line 240 in run
File "/home/ubuntu/django-main/django/test/runner.py", line 972 in run_suite
File "/home/ubuntu/django-main/django/test/runner.py", line 1044 in run_tests
File "/home/ubuntu/django-main/tests/./runtests.py", line 429 in django_tests
File "/home/ubuntu/django-main/tests/./runtests.py", line 770 in <module>
Extension modules: pywatchman.bser, markupsafe._speedups (total: 2)
Aborted (core dumped)
__getattribute__ called with name='foo'
property `foo` called
__getattribute__ called with name='__getattr__'
__getattr__ called with name='foo'
__getattribute__ called with name='bar'
But with the new python in main branch, (with out pydebug)
I have confirmed that version 3.12.0a7 was released on April 4th and the bug does exist in this version. However, the bug has been fixed in version 3.12.0b1. Therefore, it is highly likely that your error is related to this issue.
Activity
AlexWaygood commentedon Apr 5, 2023
Cc. @wangxiang-hz and @Fidget-Spinner
Fidget-Spinner commentedon Apr 5, 2023
Thanks for finding this. I'll try to debug once there's a minimal reproducer. Sorry I'm a little swamped for the next 2 weeks.
sunmy2019 commentedon Apr 6, 2023
NB: when running this test with debug build, it crashes.
sunmy2019 commentedon Apr 6, 2023
I got a minimal repo!
Running in older Python version, we got
Call flow:
But with the new python in main branch, (with out pydebug)
More precuriously, when I try to add some debug lines like this:
The new python outputs,
Everything just works fine? Looks like something in C is corrupting ❓ ❓ ❓
sunmy2019 commentedon Apr 6, 2023
Now with
pydebugon, I got the output from new python: (crashes with/without debug line)I can confirm, for this minimum repo, crash starts at aa0a73d
add test case for pythongh-103272
Merge branch 'main' into test-case-for-pythongh-103272
gh-103272: regression test for getattr exception in property (#103336)
pythongh-103272: regression test for getattr exception in property (p…
gh-103272: regression test for getattr exception in property (GH-103336)
hauntsaninja commentedon Apr 7, 2023
Thanks for the report and for narrowing this down!
The change that regressed this has been reverted and we've added a regression test, so I think this can be closed
pythongh-103272: regression test for getattr exception in property (p…
zzzeek commentedon May 24, 2023
WHEW, hi all, been bisecting all day (including getting better at bisecting large C code bases) to get here.
SQLAlchemy has been having failures on this in 3.12.0a7 and seem to be good in 3.12.0b1, just wanted to make sure this was logged.
FTR, here's our test case:
with the bug it throws a RecursionError
wangxiang-hz commentedon Jun 1, 2023
I have confirmed that version 3.12.0a7 was released on April 4th and the bug does exist in this version. However, the bug has been fixed in version 3.12.0b1. Therefore, it is highly likely that your error is related to this issue.
sunmy2019 commentedon Jun 1, 2023
It is. Test coverage is added in #103272