Skip to content

gh-145492: fix regression test for defaultdict factory repr#145788

Open
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/test-fix-regression-test-for-defaultdict-factory-repr
Open

gh-145492: fix regression test for defaultdict factory repr#145788
KowalskiThomas wants to merge 1 commit intopython:mainfrom
KowalskiThomas:kowalski/test-fix-regression-test-for-defaultdict-factory-repr

Conversation

@KowalskiThomas
Copy link
Contributor

@KowalskiThomas KowalskiThomas commented Mar 10, 2026

What is this PR?

This PR fixes the regression test introduced in #145761 and that did not properly reproduce the issue.

Running the test without the repr changes now properly crashes.

% ./python.exe -m unittest test.test_defaultdict
..........E..
======================================================================
ERROR: test_repr_recursive_factory (test.test_defaultdict.TestDefaultDict.test_repr_recursive_factory)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/thomas.kowalski/Documents/cpython/Lib/test/test_defaultdict.py", line 219, in test_repr_recursive_factory
    r = repr(dd)
  File "/Users/thomas.kowalski/Documents/cpython/Lib/test/test_defaultdict.py", line 215, in __repr__
    return f"ProblematicFactory for {dd}"
                                    ^^^^
  File "/Users/thomas.kowalski/Documents/cpython/Lib/test/test_defaultdict.py", line 215, in __repr__
    return f"ProblematicFactory for {dd}"
                                    ^^^^
  File "/Users/thomas.kowalski/Documents/cpython/Lib/test/test_defaultdict.py", line 215, in __repr__
    return f"ProblematicFactory for {dd}"
                                    ^^^^
  [Previous line repeated 981 more times]
RecursionError: maximum recursion depth exceeded

----------------------------------------------------------------------
Ran 13 tests in 1.742s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants