diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-07-22 07:15:19 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-07-22 07:15:19 -0400 |
commit | 289222bd5ec1186ddae613cb74b59963ac3f87b8 (patch) | |
tree | d0abe2aab64ed86791fff62f61eb331e37836161 /lab | |
parent | fad9ecf1733fb7d928d12ef2574c505657a4e8c4 (diff) | |
download | python-coveragepy-git-289222bd5ec1186ddae613cb74b59963ac3f87b8.tar.gz |
test: show hash-based pyc fields in show_pyc
https://www.python.org/dev/peps/pep-0552/
Diffstat (limited to 'lab')
-rw-r--r-- | lab/show_pyc.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lab/show_pyc.py b/lab/show_pyc.py index 393e84d2..e346930a 100644 --- a/lab/show_pyc.py +++ b/lab/show_pyc.py @@ -26,12 +26,14 @@ def show_pyc_file(fname): if sys.version_info >= (3, 7): # 3.7 added a flags word flags = struct.unpack('<L', f.read(4))[0] - hash_based = flags & 0x01 - check_source = flags & 0x02 + hash_based = bool(flags & 0x01) + check_source = bool(flags & 0x02) print(f"flags 0x{flags:08x}") if hash_based: source_hash = f.read(8) read_date_and_size = False + print(f"hash {binascii.hexlify(source_hash)}") + print(f"check_source {check_source}") if read_date_and_size: moddate = f.read(4) modtime = time.asctime(time.localtime(struct.unpack('<L', moddate)[0])) |