mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-36346: Make using the legacy Unicode C API optional (GH-21437)
Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0 makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
This commit is contained in:
parent
9650fe0197
commit
4c8f09d7ce
17 changed files with 360 additions and 99 deletions
|
@ -976,6 +976,7 @@ class String_TestCase(unittest.TestCase):
|
|||
buf = bytearray()
|
||||
self.assertRaises(ValueError, getargs_et_hash, 'abc\xe9', 'latin1', buf)
|
||||
|
||||
@support.requires_legacy_unicode_capi
|
||||
def test_u(self):
|
||||
from _testcapi import getargs_u
|
||||
self.assertEqual(getargs_u('abc\xe9'), 'abc\xe9')
|
||||
|
@ -985,6 +986,7 @@ class String_TestCase(unittest.TestCase):
|
|||
self.assertRaises(TypeError, getargs_u, memoryview(b'memoryview'))
|
||||
self.assertRaises(TypeError, getargs_u, None)
|
||||
|
||||
@support.requires_legacy_unicode_capi
|
||||
def test_u_hash(self):
|
||||
from _testcapi import getargs_u_hash
|
||||
self.assertEqual(getargs_u_hash('abc\xe9'), 'abc\xe9')
|
||||
|
@ -994,6 +996,7 @@ class String_TestCase(unittest.TestCase):
|
|||
self.assertRaises(TypeError, getargs_u_hash, memoryview(b'memoryview'))
|
||||
self.assertRaises(TypeError, getargs_u_hash, None)
|
||||
|
||||
@support.requires_legacy_unicode_capi
|
||||
def test_Z(self):
|
||||
from _testcapi import getargs_Z
|
||||
self.assertEqual(getargs_Z('abc\xe9'), 'abc\xe9')
|
||||
|
@ -1003,6 +1006,7 @@ class String_TestCase(unittest.TestCase):
|
|||
self.assertRaises(TypeError, getargs_Z, memoryview(b'memoryview'))
|
||||
self.assertIsNone(getargs_Z(None))
|
||||
|
||||
@support.requires_legacy_unicode_capi
|
||||
def test_Z_hash(self):
|
||||
from _testcapi import getargs_Z_hash
|
||||
self.assertEqual(getargs_Z_hash('abc\xe9'), 'abc\xe9')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue