From b30f52a4715407d7be78569123b7379dc47299cb Mon Sep 17 00:00:00 2001
From: Jeremy Hylton <jeremy@alum.mit.edu>
Date: Thu, 25 Feb 1999 16:14:58 +0000
Subject: http_error had the 'data is None' test backwards.  don't call with
 the extra argument if data is None.

---
 Lib/urllib.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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 @@ class URLopener:
         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):
-- 
cgit v0.12

