MCPcopy Index your code
hub / github.com/python/cpython / ProblematicFactory

Class ProblematicFactory

Lib/test/test_defaultdict.py:210–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208 # gh-145492: defaultdict.__repr__ should not cause infinite recursion
209 # when the factory's __repr__ calls repr() on the defaultdict.
210 class ProblematicFactory:
211 def __call__(self):
212 return {}
213 def __repr__(self):
214 repr(dd)
215 return f"ProblematicFactory for {dd}"
216
217 dd = defaultdict(ProblematicFactory())
218 # Should not raise RecursionError

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…