diff Lib/test/test_subprocess.py @ 65415:340359d80ca0

test_subprocess: use surrogateescape error handler to write shell scripts test_args_string() and test_call_string() create shell scripts including the path to the Python executable: use surrogateescape to encode paths including surrogate characters.
author Victor Stinner <victor.stinner@haypocalc.com>
date Sat, 16 Oct 2010 23:46:43 +0000
parents e2c98c60dd64
children 0ee86fd902f1
line wrap: on
line diff
--- a/Lib/test/test_subprocess.py	Sat Oct 16 23:38:07 2010 +0000
+++ b/Lib/test/test_subprocess.py	Sat Oct 16 23:46:43 2010 +0000
@@ -752,7 +752,7 @@
         # args is a string
         fd, fname = mkstemp()
         # reopen in text mode
-        with open(fd, "w") as fobj:
+        with open(fd, "w", errors="surrogateescape") as fobj:
             fobj.write("#!/bin/sh\n")
             fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
                        sys.executable)
@@ -795,7 +795,7 @@
         # call() function with string argument on UNIX
         fd, fname = mkstemp()
         # reopen in text mode
-        with open(fd, "w") as fobj:
+        with open(fd, "w", errors="surrogateescape") as fobj:
             fobj.write("#!/bin/sh\n")
             fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
                        sys.executable)