summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-07-10 20:26:06 (GMT)
committerGitHub <noreply@github.com>2020-07-10 20:26:06 (GMT)
commit4c8f09d7cef8c7aa07d5b5232b5b64f63819a743 (patch)
tree2d90e13b6dc939f019a6cafc45ea604cbb90f584 /Lib/test/support
parent9650fe0197779b4dfded94be111e39c5810f098f (diff)
downloadcpython-4c8f09d7cef8c7aa07d5b5232b5b64f63819a743.zip
cpython-4c8f09d7cef8c7aa07d5b5232b5b64f63819a743.tar.gz
cpython-4c8f09d7cef8c7aa07d5b5232b5b64f63819a743.tar.bz2
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.
Diffstat (limited to 'Lib/test/support')
-rw-r--r--Lib/test/support/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index b21978a..1ce3a78 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -36,6 +36,11 @@ from .warnings_helper import (
from .testresult import get_test_runner
+try:
+ from _testcapi import unicode_legacy_string
+except ImportError:
+ unicode_legacy_string = None
+
__all__ = [
# globals
"PIPE_MAX_SIZE", "verbose", "max_memuse", "use_resources", "failfast",
@@ -426,6 +431,9 @@ def requires_lzma(reason='requires lzma'):
lzma = None
return unittest.skipUnless(lzma, reason)
+requires_legacy_unicode_capi = unittest.skipUnless(unicode_legacy_string,
+ 'requires legacy Unicode C API')
+
is_jython = sys.platform.startswith('java')
is_android = hasattr(sys, 'getandroidapilevel')