John Vandenberg has uploaded a new change for review.

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

Change subject: Support Python 2.7.9 SSL
......................................................................

Support Python 2.7.9 SSL

Python 2.7.9 includes a backport of the SSL module from Python 3,
which uses created an error in the test test_https_cert_error.

Bug: T78764
Change-Id: I745db16c74eddbeeb89a663170c25e3548532ca1
---
M pywikibot/comms/http.py
1 file changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/82/180482/1

diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 7907165..b3ac5f5 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -44,7 +44,6 @@
 
 if sys.version_info[0] > 2:
     from ssl import SSLError as SSLHandshakeError
-    SSL_CERT_VERIFY_FAILED_MSG = "SSL: CERTIFICATE_VERIFY_FAILED"
     import queue as Queue
     import urllib.parse as urlparse
     from http import cookiejar as cookielib
@@ -54,11 +53,6 @@
         from httplib2 import SSLHandshakeError
     elif httplib2.__version__ == '0.6.0':
         from httplib2 import ServerNotFoundError as SSLHandshakeError
-
-    # The OpenSSL error code for
-    #   certificate verify failed
-    # cf. `openssl errstr 14090086`
-    SSL_CERT_VERIFY_FAILED_MSG = ":14090086:"
 
     import Queue
     import urlparse
@@ -73,8 +67,17 @@
 from pywikibot.tools import deprecate_arg
 import pywikibot.version
 
-_logger = "comm.http"
+if sys.version_info[0] > 2 or sys.version_info[1] > 8:
+    # Python 2.7.9 includes a backport of the ssl module from Python 3
+    # https://www.python.org/dev/peps/pep-0466/
+    SSL_CERT_VERIFY_FAILED_MSG = "SSL: CERTIFICATE_VERIFY_FAILED"
+else:
+    # The OpenSSL error code for
+    #   certificate verify failed
+    # cf. `openssl errstr 14090086`
+    SSL_CERT_VERIFY_FAILED_MSG = ":14090086:"
 
+_logger = "comm.http"
 
 # global variables
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I745db16c74eddbeeb89a663170c25e3548532ca1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to