Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r73826:176c74c9bf1f
Date: 2014-10-06 15:22 +0200
http://bitbucket.org/pypy/pypy/changeset/176c74c9bf1f/
Log: A simple check for consistency, should fail at some point if the
format doesn't match
diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py
--- a/pypy/stm/print_stm_log.py
+++ b/pypy/stm/print_stm_log.py
@@ -30,6 +30,9 @@
STM_GC_MAJOR_START = 13
STM_GC_MAJOR_DONE = 14
+_STM_EVENT_N = 15
+
+
event_name = {}
for _key, _value in globals().items():
if _key.startswith('STM_'):
@@ -62,6 +65,8 @@
if not packet: break
sec, nsec, threadnum, otherthreadnum, event, len1, len2 = \
struct.unpack("IIIIBBB", packet)
+ if event >= _STM_EVENT_N:
+ raise ValueError("the file %r appears corrupted")
m1 = f.read(len1)
m2 = f.read(len2)
result.append(LogEntry(sec + 0.000000001 * nsec,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit