[Python-modules-commits] [python-urllib3] 13/15: Do not use embedded copy of ssl.match_hostname, when possible

Daniele Tricoli eriol-guest at moszumanska.debian.org
Thu May 26 03:59:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

eriol-guest pushed a commit to branch master
in repository python-urllib3.

commit 21501b42c55182861ad7afe82d5267f442722e03
Author: Stefano Rivera <stefanor at debian.org>
Date:   Thu Oct 8 13:19:51 2015 -0700

    Do not use embedded copy of ssl.match_hostname, when possible
    
     The system python has the necessary features backported, since 2.7.8-7 (and
     221a1f9155e2, releasing in 2.7.9, upstream). However, alternative python
     implementations don't, yet, and urllib3 is used by pip in virtualenvs.
    Forwarded: not-needed
    Last-Update: 2014-11-18
    
    Patch-Name: 05_avoid-embedded-ssl-match-hostname.patch
---
 urllib3/packages/__init__.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/urllib3/packages/__init__.py b/urllib3/packages/__init__.py
index 170e974..4a39b72 100644
--- a/urllib3/packages/__init__.py
+++ b/urllib3/packages/__init__.py
@@ -1,5 +1,11 @@
 from __future__ import absolute_import
 
-from . import ssl_match_hostname
-
 __all__ = ('ssl_match_hostname', )
+
+try:
+    # cPython >= 2.7.9 has ssl features backported from Python3
+    from ssl import CertificateError
+    del CertificateError
+    import ssl as ssl_match_hostname
+except ImportError:
+    from . import ssl_match_hostname

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-urllib3.git



More information about the Python-modules-commits mailing list