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

Correctly figure out exc_info in ConsoleRenderer. #483

Merged
merged 4 commits into from
Feb 6, 2023
Merged

Correctly figure out exc_info in ConsoleRenderer. #483

merged 4 commits into from
Feb 6, 2023

Conversation

aclemons
Copy link
Contributor

@aclemons aclemons commented Dec 10, 2022

Summary

If the exc_info key was filled with a raw exception, and not a tuple,
the ConsoleRenderer code would call sys.exc_info and overwrite it.
This is different to how the other processors handle the exc_info key.

Additionally, if that call to sys.exc_info returned None, an explosion
would happen. This is the case if we placed an exception in exc_info,
but did not actually log until outside of the except block.

Closes #482

Pull Request Check List

  • Added tests for changed code.
    • The CI fails with less than 100% coverage.
  • New APIs are added to typing_examples.py.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      Find the appropriate next version in our __init__.py file.
  • Documentation in .rst and .md files is written using semantic newlines.
  • Changes (and possible deprecations) are documented in the changelog.
  • Consider granting push permissions to the PR branch, so maintainers can fix minor issues themselves without pestering you.

@hynek
Copy link
Owner

hynek commented Dec 19, 2022

Thanks! Would you mind adding a regression test and a changelog entry please?

If the `exc_info` key was filled with a raw exception, and not a tuple,
the `ConsoleRenderer` code would call `sys.exc_info` and overwrite it.
This is different to how the other processors handle the exc_info key.

Additionally, if that call to `sys.exc_info` returned None, an explosion
would happen.  This is the case if we placed an exception in `exc_info`,
but did not actually log until outside of the `except` block.
@aclemons
Copy link
Contributor Author

@hynek Sorry for the delay. I've added some basic tests and an entry to the CHANGELOG.md

@hynek hynek merged commit 2eedf6d into hynek:main Feb 6, 2023
@hynek
Copy link
Owner

hynek commented Feb 6, 2023

Thanks!

@aclemons aclemons deleted the gh-482 branch February 7, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConsoleRenderer does not handle non-tuple exc_info
2 participants