[Python-3000-checkins] r55363 - in python/branches/py3k-struni/Lib: subprocess.py test/test_sys.py

guido.van.rossum python-3000-checkins at python.org
Wed May 16 00:32:12 CEST 2007


Author: guido.van.rossum
Date: Wed May 16 00:32:02 2007
New Revision: 55363

Modified:
   python/branches/py3k-struni/Lib/subprocess.py
   python/branches/py3k-struni/Lib/test/test_sys.py
Log:
Make test_sys pass.


Modified: python/branches/py3k-struni/Lib/subprocess.py
==============================================================================
--- python/branches/py3k-struni/Lib/subprocess.py	(original)
+++ python/branches/py3k-struni/Lib/subprocess.py	Wed May 16 00:32:02 2007
@@ -287,7 +287,6 @@
 mswindows = (sys.platform == "win32")
 
 import os
-import types
 import traceback
 
 # Exception classes used by this module.
@@ -700,7 +699,7 @@
                            errread, errwrite):
             """Execute program (MS Windows version)"""
 
-            if not isinstance(args, types.StringTypes):
+            if not isinstance(args, basestring):
                 args = list2cmdline(args)
 
             # Process startup details
@@ -917,7 +916,7 @@
                            errread, errwrite):
             """Execute program (POSIX version)"""
 
-            if isinstance(args, types.StringTypes):
+            if isinstance(args, basestring):
                 args = [args]
             else:
                 args = list(args)
@@ -1005,7 +1004,7 @@
             # Wait for exec to fail or succeed; possibly raising exception
             data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
             os.close(errpipe_read)
-            if data != "":
+            if data:
                 os.waitpid(self.pid, 0)
                 child_exception = pickle.loads(data)
                 raise child_exception

Modified: python/branches/py3k-struni/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_sys.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_sys.py	Wed May 16 00:32:02 2007
@@ -174,7 +174,7 @@
         if test.test_support.have_unicode:
             self.assertRaises(TypeError, sys.getdefaultencoding, 42)
             # can't check more than the type, as the user might have changed it
-            self.assert_(isinstance(sys.getdefaultencoding(), str))
+            self.assert_(isinstance(sys.getdefaultencoding(), basestring))
 
     # testing sys.settrace() is done in test_trace.py
     # testing sys.setprofile() is done in test_profile.py
@@ -349,7 +349,7 @@
 
     def test_intern(self):
         self.assertRaises(TypeError, sys.intern)
-        s = "never interned before"
+        s = str8("never interned before")
         self.assert_(sys.intern(s) is s)
         s2 = s.swapcase().swapcase()
         self.assert_(sys.intern(s2) is s)


More information about the Python-3000-checkins mailing list