Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a5dd5c

Browse files
committed
Merged revisions 84909-84913 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r84909 | antoine.pitrou | 2010-09-20 00:46:05 +0200 (lun., 20 sept. 2010) | 3 lines Try to fix test_subprocess on "x86 debian parallel 3.x" buildbot ........ r84910 | antoine.pitrou | 2010-09-20 01:06:53 +0200 (lun., 20 sept. 2010) | 3 lines Try to make signal-sending tests in test_subprocess more robust on slow machines ........ r84911 | antoine.pitrou | 2010-09-20 01:28:30 +0200 (lun., 20 sept. 2010) | 3 lines Make error more explicit in test_finalize_with_trace ........ r84912 | antoine.pitrou | 2010-09-20 02:12:19 +0200 (lun., 20 sept. 2010) | 3 lines Try to fix buildbot failure (#9902) ........ r84913 | antoine.pitrou | 2010-09-20 03:33:21 +0200 (lun., 20 sept. 2010) | 3 lines Try a more robust implementation of _kill_process ........
1 parent 657977e commit 4a5dd5c

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

Lib/test/test_subprocess.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,12 +765,16 @@ def DISABLED_test_terminate(self):
765765

766766
def test_undecodable_env(self):
767767
for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):
768-
value_repr = repr(value).encode("ascii")
768+
value_repr = ascii(value).encode("ascii")
769769

770770
# test str with surrogates
771-
script = "import os; print(repr(os.getenv(%s)))" % repr(key)
771+
script = "import os; print(ascii(os.getenv(%s)))" % repr(key)
772772
env = os.environ.copy()
773773
env[key] = value
774+
# Force surrogate-escaping of \xFF in the child process;
775+
# otherwise it can be decoded as-is if the default locale
776+
# is latin-1.
777+
env['PYTHONFSENCODING'] = 'ascii'
774778
stdout = subprocess.check_output(
775779
[sys.executable, "-c", script],
776780
env=env)
@@ -780,7 +784,7 @@ def test_undecodable_env(self):
780784
# test bytes
781785
key = key.encode("ascii", "surrogateescape")
782786
value = value.encode("ascii", "surrogateescape")
783-
script = "import os; print(repr(os.getenv(%s)))" % repr(key)
787+
script = "import os; print(ascii(os.getenv(%s)))" % repr(key)
784788
env = os.environ.copy()
785789
env[key] = value
786790
stdout = subprocess.check_output(

Lib/test/test_threading.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def test_finalize_with_trace(self):
279279
# Issue1733757
280280
# Avoid a deadlock when sys.settrace steps into threading._shutdown
281281
import subprocess
282-
rc = subprocess.call([sys.executable, "-c", """if 1:
282+
p = subprocess.Popen([sys.executable, "-c", """if 1:
283283
import sys, threading
284284
285285
# A deadlock-killer, to prevent the
@@ -299,9 +299,14 @@ def func(frame, event, arg):
299299
return func
300300
301301
sys.settrace(func)
302-
"""])
302+
"""],
303+
stdout=subprocess.PIPE,
304+
stderr=subprocess.PIPE)
305+
stdout, stderr = p.communicate()
306+
rc = p.returncode
303307
self.assertFalse(rc == 2, "interpreted was blocked")
304-
self.assertTrue(rc == 0, "Unexpected error")
308+
self.assertTrue(rc == 0,
309+
"Unexpected error: " + ascii(stderr))
305310

306311
def test_join_nondaemon_on_shutdown(self):
307312
# Issue 1722344

0 commit comments

Comments
 (0)