[Python-checkins] cpython: #17460: Remove the strict argument of HTTPConnection and removing the

senthil.kumaran python-checkins at python.org
Mon Mar 18 22:08:37 CET 2013


http://hg.python.org/cpython/rev/c9bf987d80f1
changeset: 82735:c9bf987d80f1
user: Senthil Kumaran <senthil at uthcode.com>
date: Mon Mar 18 14:11:41 2013 -0700
summary:
 #17460: Remove the strict argument of HTTPConnection and removing the
DeprecationWarning being issued from 3.2 onwards.
files:
 Doc/library/http.client.rst | 18 +++---------------
 Lib/http/client.py | 23 +++++++----------------
 Misc/NEWS | 5 ++++-
 3 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -27,7 +27,7 @@
 The module provides the following classes:
 
 
-.. class:: HTTPConnection(host, port=None[, strict][, timeout], \
+.. class:: HTTPConnection(host, port=None[, timeout], \
 source_address=None)
 
 An :class:`HTTPConnection` instance represents one transaction with an HTTP
@@ -51,13 +51,9 @@
 .. versionchanged:: 3.2
 *source_address* was added.
 
- .. versionchanged:: 3.2
- The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses"
- are not supported anymore.
-
 
 .. class:: HTTPSConnection(host, port=None, key_file=None, \
- cert_file=None[, strict][, timeout], \
+ cert_file=None[, timeout], \
 source_address=None, *, context=None, \
 check_hostname=None)
 
@@ -89,20 +85,12 @@
 This class now supports HTTPS virtual hosts if possible (that is,
 if :data:`ssl.HAS_SNI` is true).
 
- .. versionchanged:: 3.2
- The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses"
- are not supported anymore.
 
-
-.. class:: HTTPResponse(sock, debuglevel=0[, strict], method=None, url=None)
+.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None)
 
 Class whose instances are returned upon successful connection. Not
 instantiated directly by user.
 
- .. versionchanged:: 3.2
- The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses"
- are not supported anymore.
-
 
 The following exceptions are raised as appropriate:
 
diff --git a/Lib/http/client.py b/Lib/http/client.py
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -267,8 +267,6 @@
 return email.parser.Parser(_class=_class).parsestr(hstring)
 
 
-_strict_sentinel = object()
-
 class HTTPResponse(io.RawIOBase):
 
 # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details.
@@ -278,7 +276,7 @@
 # text following RFC 2047. The basic status line parsing only
 # accepts iso-8859-1.
 
- def __init__(self, sock, debuglevel=0, strict=_strict_sentinel, method=None, url=None):
+ def __init__(self, sock, debuglevel=0, method=None, url=None):
 # If the response includes a content-length header, we need to
 # make sure that the client doesn't read more than the
 # specified number of bytes. If it does, it will block until
@@ -288,10 +286,6 @@
 # clients unless they know what they are doing.
 self.fp = sock.makefile("rb")
 self.debuglevel = debuglevel
- if strict is not _strict_sentinel:
- warnings.warn("the 'strict' argument isn't supported anymore; "
- "http.client now always assumes HTTP/1.x compliant servers.",
- DeprecationWarning, 2)
 self._method = method
 
 # The HTTPResponse object is returned via urllib. The clients
@@ -737,12 +731,8 @@
 # as a reasonable estimate of the maximum MSS.
 mss = 16384
 
- def __init__(self, host, port=None, strict=_strict_sentinel,
- timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None):
- if strict is not _strict_sentinel:
- warnings.warn("the 'strict' argument isn't supported anymore; "
- "http.client now always assumes HTTP/1.x compliant servers.",
- DeprecationWarning, 2)
+ def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
+ source_address=None):
 self.timeout = timeout
 self.source_address = source_address
 self.sock = None
@@ -1177,9 +1167,10 @@
 # XXX Should key_file and cert_file be deprecated in favour of context?
 
 def __init__(self, host, port=None, key_file=None, cert_file=None,
- strict=_strict_sentinel, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
- source_address=None, *, context=None, check_hostname=None):
- super(HTTPSConnection, self).__init__(host, port, strict, timeout,
+ timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
+ source_address=None, *, context=None,
+ check_hostname=None):
+ super(HTTPSConnection, self).__init__(host, port, timeout,
 source_address)
 self.key_file = key_file
 self.cert_file = cert_file
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -287,7 +287,10 @@
 Library
 -------
 
-Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module.
+- Issue #17460: Remove the strict argument of HTTPConnection and removing the
+ DeprecationWarning being issued from 3.2 onwards.
+
+- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module.
 
 - Issue #16389: Fixed a performance regression relative to Python 3.1 in the
 caching of compiled regular expressions.
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /