Issue #26939: Merge 3.6.

This commit is contained in:
Xavier de Gaye 2016-12-08 11:09:54 +01:00
commit 566ba3defd
3 changed files with 20 additions and 1 deletions

View File

@ -93,6 +93,7 @@ __all__ = [
"check__all__", "requires_android_level", "requires_multiprocessing_queue", "check__all__", "requires_android_level", "requires_multiprocessing_queue",
# sys # sys
"is_jython", "is_android", "check_impl_detail", "unix_shell", "is_jython", "is_android", "check_impl_detail", "unix_shell",
"setswitchinterval",
# network # network
"HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource",
# processes # processes
@ -2552,3 +2553,18 @@ def missing_compiler_executable(cmd_names=[]):
continue continue
if spawn.find_executable(cmd[0]) is None: if spawn.find_executable(cmd[0]) is None:
return cmd[0] 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)

View File

@ -1322,7 +1322,7 @@ class TestLRU:
f.cache_clear() f.cache_clear()
orig_si = sys.getswitchinterval() orig_si = sys.getswitchinterval()
sys.setswitchinterval(1e-6) support.setswitchinterval(1e-6)
try: try:
# create n threads in order to fill cache # create n threads in order to fill cache
threads = [threading.Thread(target=full, args=[k]) threads = [threading.Thread(target=full, args=[k])

View File

@ -579,6 +579,9 @@ Tests
- Issue #28217: Adds _testconsole module to test console input. - Issue #28217: Adds _testconsole module to test console input.
- Issue #26939: Add the support.setswitchinterval() function to fix
test_functools hanging on the Android armv7 qemu emulator.
What's New in Python 3.6.0 beta 1 What's New in Python 3.6.0 beta 1
================================= =================================