gh-130273: Fix traceback color output with unicode characters#142529
gh-130273: Fix traceback color output with unicode characters#142529grayjk wants to merge 5 commits intopython:mainfrom
Conversation
|
@serhiy-storchaka: Here is a PR about text width and Unicode characters :-) |
|
updated to use @serhiy-storchaka's recently added unicodedata.iter_graphemes |
|
@pablogsal @hauntsaninja as recent reviewers of traceback.py, would you mind taking look |
|
There are conflicts, please fix them. |
|
@StanFromIreland conflicts resolved |
Lib/traceback.py
Outdated
| 2 if unicodedata.east_asian_width(char) in _WIDE_CHAR_SPECIFIERS else 1 | ||
| for char in line[:offset] | ||
| ) | ||
| from _pyrepl.utils import wlen |
There was a problem hiding this comment.
I would prefer to not depend on _pyrepl in the traceback module. I would prefer to move wlen() here, and modify _pyrepl.utils to get it from traceback.
There was a problem hiding this comment.
I've moved wlen/str_width in commit 467656e and made them private (prefixed with _) to avoid putting them in traceback.__all__ but mypy isn't happy about that. Should I make them public?
There was a problem hiding this comment.
are # type: ignore comments in this case okay?
There was a problem hiding this comment.
or alternatively I could move wlen to a new support file with a name prefixed with _
Account for the display width of unicode characters so that colors and underlining in traceback output is correct
Closes #130273