{
  "schemaVersion": "ebb.rule.v1",
  "id": "python.symbol.locale.getdefaultlocale",
  "ecosystem": "python",
  "purl": "pkg:generic/python",
  "affectedVersions": "vers:pypi/>=3.11",
  "event": "deprecated",
  "severity": "low",
  "title": "locale.getdefaultlocale is deprecated",
  "summary": "Python 3.11 deprecates locale.getdefaultlocale(), to be removed in Python 3.15.",
  "replacement": "locale.setlocale(), locale.getpreferredencoding(False), or locale.getlocale()",
  "sources": [
    {
      "title": "What's New in Python 3.11",
      "url": "https://docs.python.org/3/whatsnew/3.11.html",
      "accessedAt": "2026-10-21"
    }
  ],
  "provenance": {
    "observedAt": "2026-10-21",
    "reviewedAt": "2026-10-21",
    "reviewer": "arminazimi"
  },
  "migration": {
    "constraints": [
      "Keep the behavior of the call unchanged; check the replacement's argument and return-type differences."
    ],
    "steps": [
      {
        "id": "replace-symbol",
        "title": "Use the locale API",
        "instructions": "Use locale.getlocale() for the current locale and locale.getpreferredencoding(False) for the encoding.",
        "targets": "usages"
      }
    ],
    "verification": [
      {
        "command": "python -W error::DeprecationWarning -m pytest",
        "purpose": "Run the tests with deprecation warnings as errors when pytest is used."
      }
    ]
  }
}
