Commit 7bf15cb3 authored by Benoit Pierre's avatar Benoit Pierre

fix Python 3.7 support

- update scanning code to handle pyc header change
- handle change to `Exception.__repr__` output
parent 618312be
......@@ -409,8 +409,10 @@ def scan_module(egg_dir, base, name, stubs):
module = pkg + (pkg and '.' or '') + os.path.splitext(name)[0]
if sys.version_info < (3, 3):
skip = 8 # skip magic & date
else:
elif sys.version_info < (3, 7):
skip = 12 # skip magic & date & file size
else:
skip = 16 # skip magic & reserved? & date & file size
f = open(filename, 'rb')
f.read(skip)
code = marshal.load(f)
......
......@@ -75,6 +75,8 @@ class TestExceptionSaver:
def test_unpickleable_exception(self):
class CantPickleThis(Exception):
"This Exception is unpickleable because it's not in globals"
def __repr__(self):
return 'CantPickleThis%r' % (self.args,)
with setuptools.sandbox.ExceptionSaver() as saved_exc:
raise CantPickleThis('detail')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment