Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrited deprecated in print_exception #5407

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/print_exception_fix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Replaced deprecated `sys.last_type, sys.last_value, sys.last_traceback` with `sys.last_exc`

**Security:**

* <news item>
4 changes: 2 additions & 2 deletions xonsh/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ def print_warning(msg):


def print_exception(msg=None, exc_info=None, source_msg=None):
"""Print given exception (or current if None) with/without traceback and set sys.last_type, sys.last_value, sys.last_traceback accordingly."""
"""Print given exception (or current if None) with/without traceback and set sys.last_exc accordingly."""

# is no exec_info() triple is given, use the exception beeing handled at the moment
if exc_info is None:
Expand Down Expand Up @@ -1055,7 +1055,7 @@ def print_exception(msg=None, exc_info=None, source_msg=None):
limit = 0
chain = False

sys.last_type, sys.last_value, sys.last_traceback = exc_info
sys.last_exc = exc_info

manually_set_trace, show_trace = _get_manual_env_var("XONSH_SHOW_TRACEBACK", False)
manually_set_logfile, log_file = _get_manual_env_var("XONSH_TRACEBACK_LOGFILE")
Expand Down
Loading