mirror of https://github.com/python/cpython
Support comment lines and missing indices in typeslots.h.
This commit is contained in:
parent
c83bc3c1fb
commit
b30111f29e
|
@ -7,6 +7,8 @@ print("/* Generated by typeslots.py $Revision$ */")
|
||||||
res = {}
|
res = {}
|
||||||
for line in sys.stdin:
|
for line in sys.stdin:
|
||||||
m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
|
m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
member = m.group(1)
|
member = m.group(1)
|
||||||
if member.startswith("tp_"):
|
if member.startswith("tp_"):
|
||||||
member = "ht_type."+member
|
member = "ht_type."+member
|
||||||
|
@ -22,4 +24,7 @@ for line in sys.stdin:
|
||||||
|
|
||||||
M = max(res.keys())+1
|
M = max(res.keys())+1
|
||||||
for i in range(1,M):
|
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,")
|
||||||
|
|
Loading…
Reference in New Issue