Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b30111f

Browse files
committed
Support comment lines and missing indices in typeslots.h.
1 parent c83bc3c commit b30111f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Objects/typeslots.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
res = {}
88
for line in sys.stdin:
99
m = re.match("#define Py_([a-z_]+) ([0-9]+)", line)
10+
if not m:
11+
continue
1012
member = m.group(1)
1113
if member.startswith("tp_"):
1214
member = "ht_type."+member
@@ -22,4 +24,7 @@
2224

2325
M = max(res.keys())+1
2426
for i in range(1,M):
25-
print("offsetof(PyHeapTypeObject, %s)," % res[i])
27+
if i in res:
28+
print("offsetof(PyHeapTypeObject, %s)," % res[i])
29+
else:
30+
print("0,")

0 commit comments

Comments
 (0)