Raise TypeError if bufsize argument is not an integer. Patch 1071755, slightly modified.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 8d0204e..9e326fb 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -504,6 +504,9 @@
         """Create new Popen instance."""
         _cleanup()
 
+        if not isinstance(bufsize, (int, long)):
+            raise TypeError("bufsize must be an integer")
+
         if mswindows:
             if preexec_fn is not None:
                 raise ValueError("preexec_fn is not supported on Windows "