colnotab / cpython

The Python programming language
https://www.python.org/
Other
0 stars 0 forks source link

Handle lines with multi-byte unicode characters properly #12

Closed ammaraskar closed 3 years ago

ammaraskar commented 3 years ago

This should fix #10. To be merged after #9

It converts byte offsets to character offsets in the column numbers so that cases like

raise Exception('clé')

are properly printed as

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    raise Exception('clé')
    ^^^^^^^^^^^^^^^^^^^^^^
Exception: clé

instead of

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    raise Exception('clé')
    ^^^^^^^^^^^^^^^^^^^^^^^
Exception: clé

This also fixes all of the remaining tests, meaning we can start building out the PEP657 tests after this.

isidentical commented 3 years ago

@ammaraskar would you mind rebasing this on top of bpo-43950 (just merged your fix #9), so that we can proceed.

ammaraskar commented 3 years ago

@ammaraskar would you mind rebasing this on top of bpo-43950 (just merged your fix #9), so that we can proceed.

Done!

isidentical commented 3 years ago

Thanks Ammar! Later today (in a couple of hours), I'll try to do a final rebase against CPython upstream. Seems like there a couple of changes in the compiler