Skip to content

Commit ce00d54

Browse files
committed
Fix: Two import-level DeprecationWarnings in 3.8
1 parent bdbab79 commit ce00d54

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

bottle.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
if _cmd_options.server and _cmd_options.server.startswith('gevent'):
3636
import gevent.monkey; gevent.monkey.patch_all()
3737

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

4141
from datetime import date as datedate, datetime, timedelta
@@ -84,7 +84,12 @@ def _e(): return sys.exc_info()[1]
8484
from urllib.parse import urlencode, quote as urlquote, unquote as urlunquote
8585
urlunquote = functools.partial(urlunquote, encoding='latin1')
8686
from http.cookies import SimpleCookie
87-
from collections import MutableMapping as DictMixin
87+
if py >= (3, 3, 0):
88+
from collections.abc import MutableMapping as DictMixin
89+
from types import ModuleType as new_module
90+
else:
91+
from collections import MutableMapping as DictMixin
92+
from imp import new_module
8893
import pickle
8994
from io import BytesIO
9095
from configparser import ConfigParser
@@ -102,6 +107,7 @@ def _raise(*a): raise a[0](a[1]).with_traceback(a[2])
102107
from Cookie import SimpleCookie
103108
from itertools import imap
104109
import cPickle as pickle
110+
from imp import new_module
105111
from StringIO import StringIO as BytesIO
106112
from ConfigParser import SafeConfigParser as ConfigParser
107113
if py25:
@@ -1781,7 +1787,7 @@ def __init__(self, name, impmask):
17811787
''' Create a virtual package that redirects imports (see PEP 302). '''
17821788
self.name = name
17831789
self.impmask = impmask
1784-
self.module = sys.modules.setdefault(name, imp.new_module(name))
1790+
self.module = sys.modules.setdefault(name, new_module(name))
17851791
self.module.__dict__.update({'__file__': __file__, '__path__': [],
17861792
'__all__': [], '__loader__': self})
17871793
sys.meta_path.append(self)

0 commit comments

Comments
 (0)