[Python-checkins] r87806 - python/branches/py3k/Objects/typeslots.py
martin.v.loewis
python-checkins at python.org
Thu Jan 6 20:26:21 CET 2011
Author: martin.v.loewis
Date: Thu Jan 6 20:26:21 2011
New Revision: 87806
Log:
Support comment lines and missing indices in typeslots.h.
Modified:
python/branches/py3k/Objects/typeslots.py
Modified: python/branches/py3k/Objects/typeslots.py
==============================================================================
--- python/branches/py3k/Objects/typeslots.py (original)
+++ python/branches/py3k/Objects/typeslots.py Thu Jan 6 20:26:21 2011
@@ -7,6 +7,8 @@
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 @@
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,")
More information about the Python-checkins
mailing list