Replace sys.last_type / sys.last_value / sys.last_traceback with sys.last_exc
Recipe ID
org.openrewrite.python.migrate.ReplaceSysLastExcInfoArtifactopenrewrite-migrate-pythonsys.last_type, sys.last_value, and sys.last_traceback were deprecated in Python 3.12. Replace them with their sys.last_exc-based equivalents: type(sys.last_exc), sys.last_exc, and sys.last_exc.__traceback__ respectively.
Single recipepythonmigration3.12sysProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.python.migrate.ReplaceSysLastExcInfoIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-python