summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLib/test/regrtest.py11
-rw-r--r--Lib/urllib/request.py14
2 files changed, 6 insertions, 19 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 4f74780..45b4541 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -127,7 +127,6 @@ import builtins
import faulthandler
import io
import json
-import locale
import logging
import os
import platform
@@ -1062,7 +1061,7 @@ class saved_test_environment:
'sys.warnoptions', 'threading._dangling',
'multiprocessing.process._dangling',
'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
- 'support.TESTFN', 'locale'
+ 'support.TESTFN',
)
def get_sys_argv(self):
@@ -1231,14 +1230,6 @@ class saved_test_environment:
elif os.path.isdir(support.TESTFN):
shutil.rmtree(support.TESTFN)
- _locale_categories = [getattr(locale, lc)
- for lc in dir(locale) if lc.startswith('LC_')]
- def get_locale(self):
- return tuple(map(locale.getlocale, self._locale_categories))
- def restore_locale(self, saved):
- for category, setting in zip(self._locale_categories, saved):
- locale.setlocale(category, setting)
-
def resource_info(self):
for name in self.resources:
method_suffix = name.replace('.', '_')
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 8b3cdf9..5c87591 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -143,16 +143,12 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
raise ValueError('SSL support not available')
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.options |= ssl.OP_NO_SSLv2
- if cafile or capath or cadefault:
- context.verify_mode = ssl.CERT_REQUIRED
- if cafile or capath:
- context.load_verify_locations(cafile, capath)
- else:
- context.set_default_verify_paths()
- check_hostname = True
+ context.verify_mode = ssl.CERT_REQUIRED
+ if cafile or capath:
+ context.load_verify_locations(cafile, capath)
else:
- check_hostname = False
- https_handler = HTTPSHandler(context=context, check_hostname=check_hostname)
+ context.set_default_verify_paths()
+ https_handler = HTTPSHandler(context=context, check_hostname=True)
opener = build_opener(https_handler)
elif _opener is None:
_opener = opener = build_opener()