summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-09 10:47:41 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-11-09 10:47:41 -0500
commitc5ed1e9e27565cb52ee94227122d337237ff34be (patch)
tree2fcf7550172a451a75f61dcaea39cd171df2592a
parent3f57f725ea523907c3aaf313d190e72a87fcc54c (diff)
downloadpython-coveragepy-c5ed1e9e27565cb52ee94227122d337237ff34be.tar.gz
Python 3.3 added a long to the .pyc format.
-rw-r--r--lab/show_pyc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lab/show_pyc.py b/lab/show_pyc.py
index 4a8801a..0a28e4f 100644
--- a/lab/show_pyc.py
+++ b/lab/show_pyc.py
@@ -17,6 +17,10 @@ def show_pyc_file(fname):
modtime = time.asctime(time.localtime(struct.unpack('<L', moddate)[0]))
print("magic %s" % (binascii.hexlify(magic)))
print("moddate %s (%s)" % (binascii.hexlify(moddate), modtime))
+ if sys.version_info >= (3, 3):
+ # 3.3 added another long to the header (size).
+ size = f.read(4)
+ print("pysize %s (%d)" % (binascii.hexlify(size), struct.unpack('<L', size)[0]))
code = marshal.load(f)
show_code(code)