From 1ed9847a5ae9758aada921222788c95c1aa78958 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Tue, 9 Oct 2012 00:37:09 -0700 Subject: [PATCH 1/2] Fix Issue 15922: make howto/urllib2.rst doctests pass. Patch by Chris Jerdonek. Address Ezio's review comment. --- Doc/howto/urllib2.rst | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index fade4a3487f..87f42ba0ec5 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -137,7 +137,7 @@ This is done as follows:: >>> data['location'] = 'Northampton' >>> data['language'] = 'Python' >>> url_values = urllib.parse.urlencode(data) - >>> print(url_values) + >>> print(url_values) # The order may differ from below. #doctest: +SKIP name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values @@ -207,9 +207,9 @@ e.g. :: >>> req = urllib.request.Request('http://www.pretend_server.org') >>> try: urllib.request.urlopen(req) - >>> except urllib.error.URLError as e: - >>> print(e.reason) - >>> + ... except urllib.error.URLError as e: + ... print(e.reason) #doctest: +SKIP + ... (4, 'getaddrinfo failed') @@ -315,18 +315,17 @@ geturl, and info, methods as returned by the ``urllib.response`` module:: >>> req = urllib.request.Request('http://www.python.org/fish.html') >>> try: - >>> urllib.request.urlopen(req) - >>> except urllib.error.HTTPError as e: - >>> print(e.code) - >>> print(e.read()) - >>> + ... urllib.request.urlopen(req) + ... except urllib.error.HTTPError as e: + ... print(e.code) + ... print(e.read()) #doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE + ... 404 - - - Error 404: File Not Found - ...... etc... + b'\n\n\nPage Not Found\n + ... Wrapping it Up -------------- From a256841b4bd923c5ac149a97318cde23c1086e39 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Tue, 9 Oct 2012 13:44:16 +0300 Subject: [PATCH 2/2] Issue #16174: Fix suggested usage of dummy_threading module. Patch by Berker Peksag. --- Doc/library/dummy_threading.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dummy_threading.rst b/Doc/library/dummy_threading.rst index b5783248736..30a3ebba674 100644 --- a/Doc/library/dummy_threading.rst +++ b/Doc/library/dummy_threading.rst @@ -17,7 +17,7 @@ Suggested usage is:: try: import threading except ImportError: - import dummy_threading + import dummy_threading as threading Be careful to not use this module where deadlock might occur from a thread being created that blocks waiting for another thread to be created. This often occurs