mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
bpo-43950: Distinguish errors happening on character offset decoding (GH-27217)
This commit is contained in:
parent
4868b94c60
commit
fbc349ff79
2 changed files with 23 additions and 5 deletions
|
|
@ -745,7 +745,17 @@ tb_displayline(PyTracebackObject* tb, PyObject *f, PyObject *filename, int linen
|
|||
// Convert the utf-8 byte offset to the actual character offset so we print the right number of carets.
|
||||
assert(source_line);
|
||||
Py_ssize_t start_offset = _PyPegen_byte_offset_to_character_offset(source_line, start_col_byte_offset);
|
||||
if (start_offset < 0) {
|
||||
err = ignore_source_errors() < 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
Py_ssize_t end_offset = _PyPegen_byte_offset_to_character_offset(source_line, end_col_byte_offset);
|
||||
if (end_offset < 0) {
|
||||
err = ignore_source_errors() < 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
Py_ssize_t left_end_offset = -1;
|
||||
Py_ssize_t right_start_offset = -1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue