Merged revisions 79297,79310,79382,79425-79427,79450 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79297 | florent.xicluna | 2010-03-22 18:18:18 +0100 (lun, 22 mar 2010) | 2 lines

  #7668: Fix test_httpservers failure when sys.executable contains non-ASCII bytes.
........
  r79310 | florent.xicluna | 2010-03-22 23:52:11 +0100 (lun, 22 mar 2010) | 2 lines

  Issue #8205: Remove the "Modules" directory from sys.path when Python is running from the build directory (POSIX only).
........
  r79382 | florent.xicluna | 2010-03-24 20:33:25 +0100 (mer, 24 mar 2010) | 2 lines

  Skip tests which depend on multiprocessing.sharedctypes, if _ctypes is not available.
........
  r79425 | florent.xicluna | 2010-03-25 21:32:07 +0100 (jeu, 25 mar 2010) | 2 lines

  Syntax cleanup `== None` -> `is None`
........
  r79426 | florent.xicluna | 2010-03-25 21:33:49 +0100 (jeu, 25 mar 2010) | 2 lines

  #8207: Fix test_pep277 on OS X
........
  r79427 | florent.xicluna | 2010-03-25 21:39:10 +0100 (jeu, 25 mar 2010) | 2 lines

  Fix test_unittest and test_warnings when running "python -Werror -m test.regrtest"
........
  r79450 | florent.xicluna | 2010-03-26 20:32:44 +0100 (ven, 26 mar 2010) | 2 lines

  Ensure that the failed or unexpected tests are sorted before printing.
........
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 6cf5e3e..71ec296 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -298,14 +298,22 @@
         self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin')
         os.mkdir(self.cgi_dir)
 
+        # The shebang line should be pure ASCII: use symlink if possible.
+        # See issue #7668.
+        if hasattr(os, 'symlink'):
+            self.pythonexe = os.path.join(self.parent_dir, 'python')
+            os.symlink(sys.executable, self.pythonexe)
+        else:
+            self.pythonexe = sys.executable
+
         self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
         with open(self.file1_path, 'w') as file1:
-            file1.write(cgi_file1 % sys.executable)
+            file1.write(cgi_file1 % self.pythonexe)
         os.chmod(self.file1_path, 0o777)
 
         self.file2_path = os.path.join(self.cgi_dir, 'file2.py')
         with open(self.file2_path, 'w') as file2:
-            file2.write(cgi_file2 % sys.executable)
+            file2.write(cgi_file2 % self.pythonexe)
         os.chmod(self.file2_path, 0o777)
 
         self.cwd = os.getcwd()
@@ -314,6 +322,8 @@
     def tearDown(self):
         try:
             os.chdir(self.cwd)
+            if self.pythonexe != sys.executable:
+                os.remove(self.pythonexe)
             os.remove(self.file1_path)
             os.remove(self.file2_path)
             os.rmdir(self.cgi_dir)