Add support for pycdas/pycdc using marshalled code objects

These requires the Python version to be specified as the Pyc header
magic is not present.
This commit is contained in:
clubby789
2022-06-15 11:33:11 +01:00
parent 96ef91b5f9
commit dc50479d06
4 changed files with 144 additions and 14 deletions

View File

@@ -33,13 +33,18 @@ enum PycMagic {
MAGIC_3_8 = 0x0A0D0D55,
MAGIC_3_9 = 0x0A0D0D61,
MAGIC_3_10 = 0x0A0D0D6F,
INVALID = 0,
};
PycMagic version_to_magic(int major, int minor);
class PycModule {
public:
PycModule() : m_maj(-1), m_min(-1), m_unicode(false) { }
void loadFromFile(const char* filename);
void loadFromMarshalledFile(const char *filename, int major, int minor);
bool isValid() const { return (m_maj >= 0) && (m_min >= 0); }
int majorVer() const { return m_maj; }