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

ParsedException.from_string(text).to_string() == text property violated due to anchors #333

Open
sestinj opened this issue Apr 2, 2023 · 0 comments

Comments

@sestinj
Copy link
Contributor

sestinj commented Apr 2, 2023

This traceback

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    print(add(1, "two"))
          ^^^^^^^^^^^^^
  File "add.py", line 2, in add
    return a + b
           ~~^~~
TypeError: unsupported operand type(s) for +: 'int' and 'str'

as an example includes anchors (the lines with "~" and "^"). In a separate PR, ability to parse tracebacks with these was added, but information about column number is not stored in the ParsedException object in order to reconstruct this.

To maintain the property that ParsedException.from_string(text).to_string() == text, it will be necessary to add an attribute to the ParsedException class, and the logic in both from_string for parsing and to_string for reconstruction.

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

No branches or pull requests

1 participant