mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Suppress new deprecation warnings when running the
test suite. For urllib2, move the import of gopherlib into the only function that uses it: users (including the test suite) certainly shouldn't see a deprecation warning just because they import urllib2! If they actually use gopher_open(), fine, _then_ they should see a deprecation warning.
This commit is contained in:
parent
24f7cad6ca
commit
e2c9a6cea7
4 changed files with 16 additions and 1 deletions
|
@ -89,7 +89,6 @@ f = urllib2.urlopen('http://www.python.org/')
|
|||
|
||||
import base64
|
||||
import ftplib
|
||||
import gopherlib
|
||||
import httplib
|
||||
import inspect
|
||||
import md5
|
||||
|
@ -1259,6 +1258,7 @@ class CacheFTPHandler(FTPHandler):
|
|||
|
||||
class GopherHandler(BaseHandler):
|
||||
def gopher_open(self, req):
|
||||
import gopherlib # this raises DeprecationWarning in 2.5
|
||||
host = req.get_host()
|
||||
if not host:
|
||||
raise GopherError('no host given')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue