[Git][reproducible-builds/diffoscope][master] 2 commits: Don't raise a traceback if we cannot de-marshal Python bytecode to support...
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Sun Oct 31 09:16:45 UTC 2021
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
286d5131 by Chris Lamb at 2021-10-31T09:13:20+00:00
Don't raise a traceback if we cannot de-marshal Python bytecode to support Python 3.7 loading newer .pyc files. (Re: reproducible-builds/diffoscope#284)
- - - - -
ade8e628 by Chris Lamb at 2021-10-31T09:16:02+00:00
Fix python tests on Python 3.7 with file 5.39+. (Re: reproducible-builds/diffoscope#284)
- - - - -
2 changed files:
- diffoscope/comparators/python.py
- tests/comparators/test_python.py
Changes:
=====================================
diffoscope/comparators/python.py
=====================================
@@ -38,15 +38,19 @@ class PycFile(File):
FILE_TYPE_RE = re.compile(r"^python .*byte-compiled$")
def compare_details(self, other, source=None):
- return [
- Difference.from_text(
- describe_pyc(self.path),
- describe_pyc(other.path),
- self.path,
- other.path,
- source="Python bytecode",
- )
- ]
+ try:
+ return [
+ Difference.from_text(
+ describe_pyc(self.path),
+ describe_pyc(other.path),
+ self.path,
+ other.path,
+ source="Python bytecode",
+ )
+ ]
+ except ValueError as exc:
+ self.add_comment("Could not decombile bytecode: {}".format(exc))
+ return []
def describe_pyc(filename):
=====================================
tests/comparators/test_python.py
=====================================
@@ -51,6 +51,10 @@ def differences(pyc1, pyc2):
@skip_unless_file_version_is_at_least("5.39")
+ at skipif(
+ sys.version_info < (3, 8),
+ reason="Python 3.7 cannot de-marshal test1.pyc-renamed",
+)
def test_diff(differences):
assert_diff_startswith(
differences[0],
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/4f7d531dd8ac5afb6e5d00eab17c0cfa3dc897d3...ade8e6282c6943e4d0c72bdc26579030624048f9
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/4f7d531dd8ac5afb6e5d00eab17c0cfa3dc897d3...ade8e6282c6943e4d0c72bdc26579030624048f9
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20211031/8facbbe3/attachment.htm>
More information about the rb-commits
mailing list