Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow unicode surrogates to be stored in str #4726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow unicode surrogates to be parsed
  • Loading branch information
garychia committed Mar 19, 2023
commit a787bbf1cf91c7e199c3616d6010912edaad12d0
8 changes: 0 additions & 8 deletions 8 Lib/test/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,6 @@ def test_bytes_comparison(self):
self.assertEqual('abc' == bytearray(b'abc'), False)
self.assertEqual('abc' != bytearray(b'abc'), True)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_comparison(self):
# Comparisons:
self.assertEqual('abc', 'abc')
Expand Down Expand Up @@ -766,8 +764,6 @@ def test_isidentifier_legacy(self):
warnings.simplefilter('ignore', DeprecationWarning)
self.assertTrue(_testcapi.unicode_legacy_string(u).isidentifier())

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_isprintable(self):
self.assertTrue("".isprintable())
self.assertTrue(" ".isprintable())
Expand All @@ -783,8 +779,6 @@ def test_isprintable(self):
self.assertTrue('\U0001F46F'.isprintable())
self.assertFalse('\U000E0020'.isprintable())

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_surrogates(self):
for s in ('a\uD800b\uDFFF', 'a\uDFFFb\uD800',
'a\uD800b\uDFFFa', 'a\uDFFFb\uD800a'):
Expand Down Expand Up @@ -1727,8 +1721,6 @@ def test_codecs_utf7(self):
'ill-formed sequence'):
b'+@'.decode('utf-7')

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_codecs_utf8(self):
self.assertEqual(''.encode('utf-8'), b'')
self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac')
Expand Down
2 changes: 1 addition & 1 deletion 2 compiler/parser/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<'a> StringParser<'a> {
}
}
match p {
0xD800..=0xDFFF => Ok(std::char::REPLACEMENT_CHARACTER),
0xD800..=0xDFFF => Ok(unsafe { std::char::from_u32_unchecked(p) }),
_ => std::char::from_u32(p).ok_or(unicode_error),
}
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.