{
  "id": "python/pytest-recursion-error-fixture",
  "signature": "RecursionError: maximum recursion depth exceeded",
  "signature_zh": "RecursionError: 超出最大递归深度",
  "regex": "RecursionError:\\ maximum\\ recursion\\ depth\\ exceeded",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A fixture depends on itself directly or indirectly (e.g., `def a(b): ...` and `def b(a): ...`), causing infinite recursion during fixture resolution.",
  "root_cause_type": "generic",
  "root_cause_zh": "fixture 直接或间接依赖自身（例如 `def a(b): ...` 和 `def b(a): ...`），导致 fixture 解析期间无限递归。",
  "versions": [
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Delays the crash and may cause a segfault; does not fix the circular dependency.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the dependency is intentional, renaming breaks the chain; if not, it may still be circular.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "@pytest.fixture\ndef a(request):\n    b = request.getfixturevalue('b')\n    ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "def _common_setup(): ...\n\n@pytest.fixture\ndef a():\n    return _common_setup()\n\n@pytest.fixture\ndef b():\n    return _common_setup()",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}