# HG changeset patch # User Gregory Szorc # Date 1494484320 25200 # Node ID e05cfb4a6a8e95c317139acbb62ebaaae2a033af # Parent 7e79373263abcd8c60bb7ba106319d1c8fa7ff4a sslutil: remove conditional cipher code needed for Python 2.6 We dropped support for Python 2.6. So this code to work around a missing feature on 2.6 is no longer necessary. diff -r 7e79373263ab -r e05cfb4a6a8e mercurial/sslutil.py --- a/mercurial/sslutil.py Thu May 11 18:38:43 2017 -0700 +++ b/mercurial/sslutil.py Wed May 10 23:32:00 2017 -0700 @@ -13,7 +13,6 @@ import os import re import ssl -import sys from .i18n import _ from . import ( @@ -58,9 +57,6 @@ # We implement SSLContext using the interface from the standard library. class SSLContext(object): - # ssl.wrap_socket gained the "ciphers" named argument in 2.7. - _supportsciphers = sys.version_info >= (2, 7) - def __init__(self, protocol): # From the public interface of SSLContext self.protocol = protocol @@ -92,13 +88,6 @@ self._cacerts = cafile def set_ciphers(self, ciphers): - if not self._supportsciphers: - raise error.Abort(_('setting ciphers in [hostsecurity] is not ' - 'supported by this version of Python'), - hint=_('remove the config option or run ' - 'Mercurial with a modern Python ' - 'version (preferred)')) - self._ciphers = ciphers def wrap_socket(self, socket, server_hostname=None, server_side=False): @@ -113,11 +102,9 @@ 'cert_reqs': self.verify_mode, 'ssl_version': self.protocol, 'ca_certs': self._cacerts, + 'ciphers': self._ciphers, } - if self._supportsciphers: - args['ciphers'] = self._ciphers - return ssl.wrap_socket(socket, **args) def _hostsettings(ui, hostname):