]> granicus.if.org Git - python/commitdiff
Support comment lines and missing indices in typeslots.h.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 6 Jan 2011 19:26:21 +0000 (19:26 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 6 Jan 2011 19:26:21 +0000 (19:26 +0000)
Objects/typeslots.py

index 686fb6fcf6eb003257f7bf0c9b5c243f733f2523..2e00c80fbbe08342b87a33e28355169413ebd463 100644 (file)
@@ -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,")