Skip to content

Commit

Permalink
Fix: Two import-level DeprecationWarnings in 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Dec 1, 2019
1 parent bdbab79 commit ce00d54
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
if _cmd_options.server and _cmd_options.server.startswith('gevent'):
import gevent.monkey; gevent.monkey.patch_all()

import base64, cgi, email.utils, functools, hmac, imp, itertools, mimetypes,\
import base64, cgi, email.utils, functools, hmac, itertools, mimetypes,\
os, re, subprocess, sys, tempfile, threading, time, warnings

from datetime import date as datedate, datetime, timedelta
Expand Down Expand Up @@ -84,7 +84,12 @@ def _e(): return sys.exc_info()[1]
from urllib.parse import urlencode, quote as urlquote, unquote as urlunquote
urlunquote = functools.partial(urlunquote, encoding='latin1')
from http.cookies import SimpleCookie
from collections import MutableMapping as DictMixin
if py >= (3, 3, 0):
from collections.abc import MutableMapping as DictMixin
from types import ModuleType as new_module
else:
from collections import MutableMapping as DictMixin
from imp import new_module
import pickle
from io import BytesIO
from configparser import ConfigParser
Expand All @@ -102,6 +107,7 @@ def _raise(*a): raise a[0](a[1]).with_traceback(a[2])
from Cookie import SimpleCookie
from itertools import imap
import cPickle as pickle
from imp import new_module
from StringIO import StringIO as BytesIO
from ConfigParser import SafeConfigParser as ConfigParser
if py25:
Expand Down Expand Up @@ -1781,7 +1787,7 @@ def __init__(self, name, impmask):
''' Create a virtual package that redirects imports (see PEP 302). '''
self.name = name
self.impmask = impmask
self.module = sys.modules.setdefault(name, imp.new_module(name))
self.module = sys.modules.setdefault(name, new_module(name))
self.module.__dict__.update({'__file__': __file__, '__path__': [],
'__all__': [], '__loader__': self})
sys.meta_path.append(self)
Expand Down

0 comments on commit ce00d54

Please sign in to comment.