Skip to content

Commit

Permalink
Change PythonCompiledFile.validate()
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Nov 8, 2022
1 parent 34a1daa commit 0649762
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions hachoir/parser/program/python.py
Expand Up @@ -524,13 +524,7 @@ def validate(self):
if self["magic_string"].value != "\r\n":
return r"Wrong magic string (\r\n)"

version = self.getVersion()
if version >= 0x3030000 and self['magic_number'].value >= 3200:
offset = 12
else:
offset = 8
value = self.stream.readBits(offset * 8, 7, self.endian)
if value != ord(b'c'):
if self["content/bytecode"].value != "c":
return "First object bytecode is not code"
return True

Expand Down

0 comments on commit 0649762

Please sign in to comment.