XZise has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/191042

Change subject: [FIX] threadedhttp: Don't unpack exceptions
......................................................................

[FIX] threadedhttp: Don't unpack exceptions

If the redirect issued an exception, it shouldn't be unpacked but
instead directly returned like a normal exception.

Change-Id: Iaf548e569e774c6ee4682edf5f571b12321588d7
---
M pywikibot/comms/threadedhttp.py
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/42/191042/1

diff --git a/pywikibot/comms/threadedhttp.py b/pywikibot/comms/threadedhttp.py
index 43358ef..e3c0e64 100644
--- a/pywikibot/comms/threadedhttp.py
+++ b/pywikibot/comms/threadedhttp.py
@@ -254,10 +254,12 @@
                                   method in ["GET", "HEAD"]))
         if (self.follow_redirects and (max_redirects > 0) and
                 redirectable_response):
-            (response, content) = self._follow_redirect(
+            # Return directly and not unpack the values in case the result was
+            # an exception, which can't be unpacked
+            return self._follow_redirect(
                 uri, method, body, headers, response, content, max_redirects)
-
-        return response, content
+        else:
+            return response, content
 
     def _follow_redirect(self, uri, method, body, headers, response,
                          content, max_redirects):

-- 
To view, visit https://gerrit.wikimedia.org/r/191042
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf548e569e774c6ee4682edf5f571b12321588d7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <commodorefabia...@gmx.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to