diff options
author | Xavier de Gaye <xdegaye@users.sourceforge.net> | 2016-12-08 10:09:54 (GMT) |
---|---|---|
committer | Xavier de Gaye <xdegaye@users.sourceforge.net> | 2016-12-08 10:09:54 (GMT) |
commit | 566ba3defd36090a006090ada1770fbea917816d (patch) | |
tree | ed99bad2a87c901ef13605d13db592eefa46333d /Lib/test/support | |
parent | 4ebcdac556282b159f5ea2ea480d81cb7cb35ad6 (diff) | |
parent | 7522ef402c324481fabd841a89810fd944cd3cec (diff) | |
download | cpython-566ba3defd36090a006090ada1770fbea917816d.zip cpython-566ba3defd36090a006090ada1770fbea917816d.tar.gz cpython-566ba3defd36090a006090ada1770fbea917816d.tar.bz2 |
Issue #26939: Merge 3.6.
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 09a02da..1f664f6 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -93,6 +93,7 @@ __all__ = [ "check__all__", "requires_android_level", "requires_multiprocessing_queue", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", + "setswitchinterval", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", # processes @@ -2552,3 +2553,18 @@ def missing_compiler_executable(cmd_names=[]): continue if spawn.find_executable(cmd[0]) is None: return cmd[0] + + +_is_android_emulator = None +def setswitchinterval(interval): + # Setting a very low gil interval on the Android emulator causes python + # to hang (issue #26939). + minimum_interval = 1e-5 + if is_android and interval < minimum_interval: + global _is_android_emulator + if _is_android_emulator is None: + _is_android_emulator = (subprocess.check_output( + ['getprop', 'ro.kernel.qemu']).strip() == b'1') + if _is_android_emulator: + interval = minimum_interval + return sys.setswitchinterval(interval) |