[Python-Dev] Identifying magic prefix on Python files?

Tim Peters tim.one@home.com
Sun, 4 Feb 2001 16:21:16 -0500


[Guido]
> If we're going to redesign the .pyc file header, I'd propose the
> following:
>
> (1) magic number -- for file(1), never to be changed
>
> (2) some kind of version -- Python version, or API version, or
>     bytecode version
>
> (3) mtime of .py file
>
> (4) options, e.g. is this a .pyc or a .pyo
>
> (5) size of marshalled code following
>
> (6) marshalled code

Note that the magic number today is different when -U (Py_UnicodeFlag) is
specified.  That should be migrated to #4.