{
  "schemaVersion": "ebb.rule.v1",
  "id": "python.symbol.imp.source-from-cache",
  "ecosystem": "python",
  "purl": "pkg:generic/python",
  "affectedVersions": "vers:pypi/>=3.12",
  "event": "removed",
  "severity": "high",
  "title": "Imp.source_from_cache has been removed",
  "summary": "Python 3.12 removed imp.source_from_cache, so using it raises an error.",
  "replacement": "importlib.util.source_from_cache()",
  "sources": [
    {
      "title": "What's New in Python 3.12",
      "url": "https://docs.python.org/3/whatsnew/3.12.html",
      "accessedAt": "2026-10-21"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-21",
    "reviewedAt": "2026-10-21",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Keep the behavior of the code unchanged; check the replacement's argument and return-value differences."
    ],
    "steps": [
      {
        "id": "replace-symbol",
        "title": "Replace the usage",
        "instructions": "Replace each reported use of imp.source_from_cache with importlib.util.source_from_cache().",
        "targets": "usages"
      }
    ],
    "verification": [
      {
        "command": "python -W error::DeprecationWarning -m pytest",
        "purpose": "Run the tests with deprecation warnings as errors when pytest is used."
      }
    ]
  }
}
