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

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

## Root Cause

A fixture directly or indirectly depends on itself, causing infinite recursion during fixture resolution. This often happens when a fixture has the same name as a parameter it requests.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   @pytest.fixture
def db_connection():
    return create_connection()

@pytest.fixture
def db_session(db_connection):  # Different name
    return Session(db_connection)
   ```
2. **** (85% success)
   ```
   @pytest.fixture
def my_fixture(request):
    other = request.getfixturevalue('other_fixture')
    return process(other)
   ```

## Dead Ends

- **** — This delays the inevitable crash and may cause a stack overflow, potentially crashing the Python interpreter. (90% fail)
- **** — RecursionError occurs during fixture resolution, before the fixture body executes. The try/except inside the fixture never catches it. (95% fail)
