diff options
author | Marcel Hellkamp <marc@gsites.de> | 2019-12-01 16:24:18 +0100 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2019-12-01 16:24:18 +0100 |
commit | ce00d547a663a5174501988ab6b09ca2fb08eee5 (patch) | |
tree | e154d3b4c6daaf3de0637d032903e9c3d9e62d2a | |
parent | bdbab79254c75f1ce9175e9657d40aa4639854de (diff) | |
download | bottle-ce00d547a663a5174501988ab6b09ca2fb08eee5.tar.gz |
Fix: Two import-level DeprecationWarnings in 3.8
-rw-r--r-- | bottle.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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) |