diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-01-06 19:26:21 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-01-06 19:26:21 (GMT) |
commit | b30111f29e0759271cb66ba1fd27a9fd1a884f96 (patch) | |
tree | dd42c4ed11e2e457d4fbcf3cb54065ff3e358688 | |
parent | c83bc3c1fbed14d27a5de3032e24d2cf006a7c4b (diff) | |
download | cpython-b30111f29e0759271cb66ba1fd27a9fd1a884f96.zip cpython-b30111f29e0759271cb66ba1fd27a9fd1a884f96.tar.gz cpython-b30111f29e0759271cb66ba1fd27a9fd1a884f96.tar.bz2 |
Support comment lines and missing indices in typeslots.h.
-rw-r--r-- | Objects/typeslots.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/typeslots.py b/Objects/typeslots.py index 686fb6f..2e00c80 100644 --- a/Objects/typeslots.py +++ b/Objects/typeslots.py @@ -7,6 +7,8 @@ print("/* Generated by typeslots.py $Revision$ */") res = {} for line in sys.stdin: m = re.match("#define Py_([a-z_]+) ([0-9]+)", line) + if not m: + continue member = m.group(1) if member.startswith("tp_"): member = "ht_type."+member @@ -22,4 +24,7 @@ for line in sys.stdin: M = max(res.keys())+1 for i in range(1,M): - print("offsetof(PyHeapTypeObject, %s)," % res[i]) + if i in res: + print("offsetof(PyHeapTypeObject, %s)," % res[i]) + else: + print("0,") |