mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Silence the DeprecationWarning raised by importing mimetools in BaseHTTPServer.
This does have an unfortunate side-effect of silencing the warning for all subsequent code that imports mimetools as well since the warning is only executed upon the first import of mimetools.
This commit is contained in:
parent
1e296cc858
commit
abe423ed2c
2 changed files with 9 additions and 1 deletions
|
|
@ -73,7 +73,12 @@ __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
|
|||
import sys
|
||||
import time
|
||||
import socket # For gethostbyaddr()
|
||||
import mimetools
|
||||
from test.test_support import catch_warning
|
||||
from warnings import filterwarnings
|
||||
with catch_warning(record=False):
|
||||
filterwarnings("ignore", ".*mimetools has been removed",
|
||||
DeprecationWarning)
|
||||
import mimetools
|
||||
import SocketServer
|
||||
|
||||
# Default error message template
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue