diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-01-31 23:38:15 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-01-31 23:38:15 +0100 |
commit | 6a42ea50f90d4abec45e44798e5d0bfeeb5d33c2 (patch) | |
tree | 35fbd74535dc52b856f4453c6a7c4e580f7054a9 | |
parent | ec11294a551d166c77d9cb0663fb3e6fded2f2f5 (diff) | |
download | m2crypto-6a42ea50f90d4abec45e44798e5d0bfeeb5d33c2.tar.gz |
Upgrade embedded six module to 1.16.0.
-rw-r--r-- | src/M2Crypto/six.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/M2Crypto/six.py b/src/M2Crypto/six.py index 83f6978..d4fe984 100644 --- a/src/M2Crypto/six.py +++ b/src/M2Crypto/six.py @@ -29,7 +29,7 @@ import sys import types __author__ = "Benjamin Peterson <benjamin@python.org>" -__version__ = "1.15.0" +__version__ = "1.16.0" # Useful for very coarse version differentiation. @@ -71,6 +71,11 @@ else: MAXSIZE = int((1 << 63) - 1) del X +if PY34: + from importlib.util import spec_from_loader +else: + spec_from_loader = None + def _add_doc(func, doc): """Add documentation to a function.""" @@ -186,6 +191,11 @@ class _SixMetaPathImporter(object): return self return None + def find_spec(self, fullname, path, target=None): + if fullname in self.known_modules: + return spec_from_loader(fullname, self) + return None + def __get_module(self, fullname): try: return self.known_modules[fullname] @@ -223,6 +233,12 @@ class _SixMetaPathImporter(object): return None get_source = get_code # same as get_code + def create_module(self, spec): + return self.load_module(spec.name) + + def exec_module(self, module): + pass + _importer = _SixMetaPathImporter(__name__) @@ -247,7 +263,7 @@ _moved_attributes = [ MovedAttribute("reduce", "__builtin__", "functools"), MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), MovedAttribute("StringIO", "StringIO", "io"), - MovedAttribute("UserDict", "UserDict", "collections"), + MovedAttribute("UserDict", "UserDict", "collections", "IterableUserDict", "UserDict"), MovedAttribute("UserList", "UserList", "collections"), MovedAttribute("UserString", "UserString", "collections"), MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), |