summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2019-12-01 16:24:18 +0100
committerMarcel Hellkamp <marc@gsites.de>2019-12-01 16:24:18 +0100
commitce00d547a663a5174501988ab6b09ca2fb08eee5 (patch)
treee154d3b4c6daaf3de0637d032903e9c3d9e62d2a
parentbdbab79254c75f1ce9175e9657d40aa4639854de (diff)
downloadbottle-ce00d547a663a5174501988ab6b09ca2fb08eee5.tar.gz
Fix: Two import-level DeprecationWarnings in 3.8
-rw-r--r--bottle.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bottle.py b/bottle.py
index 92a577e..3700173 100644
--- a/bottle.py
+++ b/bottle.py
@@ -35,7 +35,7 @@ if __name__ == '__main__':
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
@@ -84,7 +84,12 @@ if py3k:
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
@@ -102,6 +107,7 @@ else: # 2.x
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:
@@ -1781,7 +1787,7 @@ class _ImportRedirect(object):
''' 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)