Fix bytecode compatibility with Python 3.7 beta3

This commit is contained in:
Michael Hansen
2018-04-26 14:31:21 -07:00
parent bf60a5831b
commit 0c3955883f
4 changed files with 17 additions and 7 deletions

View File

@@ -165,10 +165,21 @@ void PycModule::loadFromFile(const char* filename)
fputs("Bad MAGIC!\n", stderr);
return;
}
in.get32(); // Timestamp -- who cares?
if (verCompare(3, 3) >= 0)
in.get32(); // Size parameter added in Python 3.3
int flags = 0;
if (verCompare(3, 7) >= 0)
flags = in.get32();
if (flags & 0x1) {
// Optional checksum added in Python 3.7
in.get32();
in.get32();
} else {
in.get32(); // Timestamp -- who cares?
if (verCompare(3, 3) >= 0)
in.get32(); // Size parameter added in Python 3.3
}
m_code = LoadObject(&in, this).require_cast<PycCode>();
}