From df199af471c63a0a67fbb707b9138ecfc0560b2f Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Dec 10 2019 10:02:09 +0000 Subject: import python-requests-2.6.0-8.el7_7 --- diff --git a/SOURCES/import-urllib3-and-chardet-from-the-global-namespace.patch b/SOURCES/import-urllib3-and-chardet-from-the-global-namespace.patch new file mode 100644 index 0000000..c39ca26 --- /dev/null +++ b/SOURCES/import-urllib3-and-chardet-from-the-global-namespace.patch @@ -0,0 +1,110 @@ +diff --git a/requests/__init__.py b/requests/__init__.py +index 446500b..8257b61 100644 +--- a/requests/__init__.py ++++ b/requests/__init__.py +@@ -50,7 +50,7 @@ __copyright__ = 'Copyright 2015 Kenneth Reitz' + + # Attempt to enable urllib3's SNI support, if possible + try: +- from .packages.urllib3.contrib import pyopenssl ++ from urllib3.contrib import pyopenssl + pyopenssl.inject_into_urllib3() + except ImportError: + pass +diff --git a/requests/adapters.py b/requests/adapters.py +index 02e0dd1..daae42e 100644 +--- a/requests/adapters.py ++++ b/requests/adapters.py +@@ -11,22 +11,22 @@ and maintain connections. + import socket + + from .models import Response +-from .packages.urllib3.poolmanager import PoolManager, proxy_from_url +-from .packages.urllib3.response import HTTPResponse +-from .packages.urllib3.util import Timeout as TimeoutSauce +-from .packages.urllib3.util.retry import Retry ++from urllib3.poolmanager import PoolManager, proxy_from_url ++from urllib3.response import HTTPResponse ++from urllib3.util import Timeout as TimeoutSauce ++from urllib3.util.retry import Retry + from .compat import urlparse, basestring + from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers, + prepend_scheme_if_needed, get_auth_from_url, urldefragauth) + from .structures import CaseInsensitiveDict +-from .packages.urllib3.exceptions import ConnectTimeoutError +-from .packages.urllib3.exceptions import HTTPError as _HTTPError +-from .packages.urllib3.exceptions import MaxRetryError +-from .packages.urllib3.exceptions import ProxyError as _ProxyError +-from .packages.urllib3.exceptions import ProtocolError +-from .packages.urllib3.exceptions import ReadTimeoutError +-from .packages.urllib3.exceptions import SSLError as _SSLError +-from .packages.urllib3.exceptions import ResponseError ++from urllib3.exceptions import ConnectTimeoutError ++from urllib3.exceptions import HTTPError as _HTTPError ++from urllib3.exceptions import MaxRetryError ++from urllib3.exceptions import ProxyError as _ProxyError ++from urllib3.exceptions import ProtocolError ++from urllib3.exceptions import ReadTimeoutError ++from urllib3.exceptions import SSLError as _SSLError ++from urllib3.exceptions import ResponseError + from .cookies import extract_cookies_to_jar + from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError, + ProxyError, RetryError) +diff --git a/requests/compat.py b/requests/compat.py +index 40bb6c5..4232288 100644 +--- a/requests/compat.py ++++ b/requests/compat.py +@@ -4,7 +4,7 @@ + pythoncompat + """ + +-from .packages import chardet ++import chardet + + import sys + +diff --git a/requests/exceptions.py b/requests/exceptions.py +index 89135a8..b70c525 100644 +--- a/requests/exceptions.py ++++ b/requests/exceptions.py +@@ -7,7 +7,7 @@ requests.exceptions + This module contains the set of Requests' exceptions. + + """ +-from .packages.urllib3.exceptions import HTTPError as BaseHTTPError ++from urllib3.exceptions import HTTPError as BaseHTTPError + + + class RequestException(IOError): +diff --git a/requests/models.py b/requests/models.py +index 419cf0a..131b88d 100644 +--- a/requests/models.py ++++ b/requests/models.py +@@ -16,10 +16,10 @@ from .structures import CaseInsensitiveDict + + from .auth import HTTPBasicAuth + from .cookies import cookiejar_from_dict, get_cookie_header +-from .packages.urllib3.fields import RequestField +-from .packages.urllib3.filepost import encode_multipart_formdata +-from .packages.urllib3.util import parse_url +-from .packages.urllib3.exceptions import ( ++from urllib3.fields import RequestField ++from urllib3.filepost import encode_multipart_formdata ++from urllib3.util import parse_url ++from urllib3.exceptions import ( + DecodeError, ReadTimeoutError, ProtocolError, LocationParseError) + from .exceptions import ( + HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError, +diff --git a/requests/sessions.py b/requests/sessions.py +index 9a51f33..22bd226 100644 +--- a/requests/sessions.py ++++ b/requests/sessions.py +@@ -21,7 +21,7 @@ from .hooks import default_hooks, dispatch_hook + from .utils import to_key_val_list, default_headers, to_native_string, DEFAULT_PORTS + from .exceptions import ( + TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError) +-from .packages.urllib3._collections import RecentlyUsedContainer ++from urllib3._collections import RecentlyUsedContainer + from .structures import CaseInsensitiveDict + + from .adapters import HTTPAdapter diff --git a/SPECS/python-requests.spec b/SPECS/python-requests.spec index 6db2f4e..a27b132 100644 --- a/SPECS/python-requests.spec +++ b/SPECS/python-requests.spec @@ -9,7 +9,7 @@ Name: python-requests Version: 2.6.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: HTTP library, written in Python, for human beings License: ASL 2.0 @@ -42,6 +42,18 @@ Patch4: fix-default-port-handling.patch # Resolved upstream: https://github.com/psf/requests/commit/9b63f9cd37d19f2d4bbce42caec112ad0606d8dd Patch5: fix-leaking-test.patch +# The upstream requests library bundles urllib3 and chardet, and then +# manipulates the module namespace in order to alias the packages to +# the system ones if a distribution unbundles them. This however can lead +# to side effects, such as creating different instances of the modules +# in memory where changes can happen to a module but not reflected to another, +# leading to undefined behavior. +# This patch changes all the import statements for urllib3 and chardet to import +# from the global namespace, thus avoiding the instance duplication. +# Partial backport from https://github.com/psf/requests/pull/4067 +# Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1776294 +Patch6: import-urllib3-and-chardet-from-the-global-namespace.patch + BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-chardet >= 2.2.1-1 @@ -97,6 +109,7 @@ designed to make HTTP requests easy for developers. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 # Unbundle the certificate bundle from mozilla. rm -rf requests/cacert.pem @@ -160,6 +173,10 @@ popd %endif %changelog +* Thu Oct 24 2019 Charalampos Stratakis - 2.6.0-8 +- Import urllib3 and chardet from the global namespace +Resolves: rhbz#1776294 + * Thu Oct 03 2019 Tomas Orsava - 2.6.0-7 - Modify tests to run in pytest - Add a bcond online_tests to enable the tests