mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer()" (GH-18985)
* Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)"
This reverts commit c7ad974d34
.
* Update unicodeobject.h
This commit is contained in:
parent
7a5cbc7298
commit
3a8c56295d
5 changed files with 0 additions and 284 deletions
|
@ -2830,28 +2830,6 @@ class CAPITest(unittest.TestCase):
|
|||
self.assertEqual(unicode_asucs4(s, len(s), True), s+'\0')
|
||||
self.assertEqual(unicode_asucs4(s, len(s), False), s+'\uffff')
|
||||
|
||||
# Test _PyUnicode_GetUTF8Buffer()
|
||||
@support.cpython_only
|
||||
def test_getutf8buffer(self):
|
||||
from _testcapi import unicode_getutf8buffer, unicode_test_getutf8buffer
|
||||
|
||||
# Run tests wrtten in C. Raise an error when test failed.
|
||||
unicode_test_getutf8buffer()
|
||||
|
||||
ascii_ = "foo"
|
||||
bmp = '\u0100'
|
||||
bmp2 = '\uffff'
|
||||
nonbmp = chr(0x10ffff)
|
||||
surrogates = 'a\ud800b\udfffc'
|
||||
|
||||
self.assertEqual(unicode_getutf8buffer(ascii_), b'foo')
|
||||
self.assertEqual(unicode_getutf8buffer(bmp), b'\xc4\x80')
|
||||
self.assertEqual(unicode_getutf8buffer(bmp2), b'\xef\xbf\xbf')
|
||||
self.assertEqual(unicode_getutf8buffer(nonbmp), b'\xf4\x8f\xbf\xbf')
|
||||
self.assertRaises(UnicodeEncodeError, unicode_getutf8buffer, surrogates)
|
||||
self.assertEqual(unicode_getutf8buffer(surrogates, "surrogatepass"),
|
||||
b'a\xed\xa0\x80b\xed\xbf\xbfc')
|
||||
|
||||
# Test PyUnicode_AsUTF8()
|
||||
@support.cpython_only
|
||||
def test_asutf8(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue