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

tback: make Traceback printing compatible with Python 3 #246

Merged
merged 3 commits into from
Jan 16, 2024

Commits on Jan 12, 2024

  1. tback: make Traceback printing compatible with Python 3

    Because kobo only supports Python 3.6+, we can just return a
    concatenated unicode string with the given exception.
    
    Fixes the following incorrectly formatted output:
    ```
    $ cat test.py
    from kobo.tback import set_except_hook
    set_except_hook()
    
    assert False
    
    $ python3 test.py
    b'Traceback (most recent call last):\n  File "/Users/lzaoral/redhat/OpenScanHub/kobo/test.py", line 4, in <module>\n    assert False\nAssertionError\nFrame <module> in /Users/lzaoral/redhat/OpenScanHub/kobo/test.py at line 4\n<CODE>\n       1 from kobo.tback import set_except_hook\n       2 set_except_hook()\n       3 \n-->    4 assert False\n</CODE>\n<LOCALS>\n     __annotations__ = {}\n        __builtins__ = <module \'builtins\' (built-in)>\n          __cached__ = None\n             __doc__ = None\n            __file__ = \'/Users/lzaoral/redhat/OpenScanHub/kobo/test.py\'\n          __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x100711650>\n            __name__ = \'__main__\'\n         __package__ = None\n            __spec__ = None\n     set_except_hook = <function set_except_hook at 0x10082df80>\n</LOCALS>\n'
    ```
    lzaoral committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    23b1cec View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c2577ce View commit details
    Browse the repository at this point in the history
  3. client: simplify formatting ot XML-RPC faults

    `Traceback.get_traceback` no longer produces broken output.  Therefore, our
    reimplementation of `xmlrpc.client.Fault.__repr__` can be greatly simplified.
    lzaoral committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    461bc2a View commit details
    Browse the repository at this point in the history