[Python-Dev] Suggested .pyc header format

Ka-Ping Yee ping@lfw.org
Sun, 4 Feb 2001 18:34:29 -0800 (PST)


Here's a quick revision, to fix some alignment boundaries.
I think this ordering might make more sense.

    bytes   contents

    0-7     magic string '\x8fSpam\n\r\n'
    8-11    Python version (sys.hexversion)
    12-15   date of last incompatible VM change (YYMD, year msb-first)
    16-23   reserved (flags, etc.)
    24-27   mtime of source .py file (long int, msb-first)
    28-31   size of marshalled code (long int, msb-first)
    32-     marshalled code

In a dump, this would look like:

    ---------magic--------- --version-- --VM-date--
    8f 53 70 61 6d 0a 0d 0a 02 01 00 a2 07 d1 02 04  .Spam......".Q..
    00 00 00 00 00 00 00 00 3a 7d ae ba 00 00 73 a8  ........:}.:..s(
    ---------flags--------- ---mtime--- ---size----


-- ?!ng

"Old code doesn't die -- it just smells that way."
    -- Bill Frantz