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

- **ID:** `python/pytest-collection-recursion-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest's collection traverses symlinked directories or a conftest.py imports a module that imports pytest itself, causing infinite recursion during collection.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Find and remove symlink loops:

find tests -type l -exec sh -c 'readlink -f "$1" | grep -q "$(dirname $1)" && echo $1' _ {} \;
   ```
2. **** (85% success)
   ```
   Break the import cycle in conftest.py by moving shared helpers into a separate module that does not import pytest.
   ```

## Dead Ends

- **** — Delays the crash and may segfault; does not fix the underlying cycle. (80% fail)
- **** — Only fixes one specific symlink; other cycles remain. (70% fail)
