Skip to content

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

Description

@sestinj

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions