http_error had the 'data is None' test backwards.  don't call with the
extra argument if data is None.
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 3c8bc0f..7319bd6 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -290,12 +290,11 @@
         if hasattr(self, name):
             method = getattr(self, name)
             if data is None:
-                result = method(url, fp, errcode, errmsg, headers, data)
-            else:
                 result = method(url, fp, errcode, errmsg, headers)
+            else:
+                result = method(url, fp, errcode, errmsg, headers, data)
             if result: return result
-        return self.http_error_default(
-            url, fp, errcode, errmsg, headers)
+        return self.http_error_default(url, fp, errcode, errmsg, headers)
 
     # Default http error handler: close the connection and raises IOError
     def http_error_default(self, url, fp, errcode, errmsg, headers):