mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Merge pull request #3006 from tony-jinwoo-ahn/utf
Fix range of "invalid start byte" for UTF-8
This commit is contained in:
2
Lib/test/test_unicode.py
vendored
2
Lib/test/test_unicode.py
vendored
@@ -1896,8 +1896,6 @@ class UnicodeTest(string_tests.CommonTest,
|
||||
self.assertEqual((b'aaaa' + seq + b'bbbb').decode('utf-8', 'ignore'),
|
||||
'aaaa' + res + 'bbbb')
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_invalid_start_byte(self):
|
||||
"""
|
||||
Test that an 'invalid start byte' error is raised when the first byte
|
||||
|
||||
@@ -89,7 +89,7 @@ pub mod utf8 {
|
||||
let err_idx = remaining_index + e.valid_up_to();
|
||||
remaining_data = rest;
|
||||
remaining_index += valid_prefix.len();
|
||||
if (0x80..0xc0).contains(&first_err) {
|
||||
if (0x80..0xc2).contains(&first_err) || (0xf5..=0xff).contains(&first_err) {
|
||||
handle_error!(err_idx..err_idx + 1, "invalid start byte");
|
||||
}
|
||||
let err_len = match e.error_len() {
|
||||
|
||||
Reference in New Issue
Block a user