From 7bf15cb3c8a29545cc4869a4a1c52ac678eba1da Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Thu, 25 Jan 2018 10:27:04 +0100 Subject: fix Python 3.7 support - update scanning code to handle pyc header change - handle change to `Exception.__repr__` output --- setuptools/command/bdist_egg.py | 4 +++- setuptools/tests/test_sandbox.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'setuptools') diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 5fdb62d9..d222c208 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -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) diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index a3f1206d..d8675422 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -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') -- cgit v1.2.1