A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-March/021035.html below:

[Python-Dev] Python interpreter crash.

[Python-Dev] Python interpreter crash. [Python-Dev] Python interpreter crash.Tim Peters tim.one@comcast.net
Tue, 12 Mar 2002 23:30:12 -0500
[Guido]
> f = open("foo.pyc")
> f.seek(8)
> code = marshal.load(f)

[Greg Ewing]
> Ah! I was trying to do something like that a minute ago before
> answering the original query, but the magic number 8 eluded me. Is it
> documented anywhere, or is mystic knowledge required?

Mystic knowledge:  these are internal implementation details, and not
formally guaranteed across releases.

The first 4 bytes of a .py[co] are a "magic number", and the next 4 a
timestamp.  That the first 4 bytes hold a magic number is documented with
PyImport_GetMagicNumber().  I'm not sure the timestamp part is documented
anywhere in the manuals; it can be guessed from staring at
Tools/scripts/checkpyc.py or Lib/py_compile.py.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4