MCPcopy Index your code
hub / github.com/python/cpython / combinefile

Function combinefile

Tools/scripts/combinerefs.py:88–122  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

86 break
87
88def combinefile(f):
89 fi = iter(f)
90
91 for line in read(fi, re.compile(r'^Remaining objects:$'), False):
92 pass
93
94 crack = re.compile(r'([a-zA-Z\d]+) \[(\d+)\] (.*)')
95 addr2rc = {}
96 addr2guts = {}
97 before = 0
98 for line in read(fi, re.compile(r'^Remaining object addresses:$'), False):
99 m = crack.match(line)
100 if m:
101 addr, addr2rc[addr], addr2guts[addr] = m.groups()
102 before += 1
103 else:
104 print('??? skipped:', line)
105
106 after = 0
107 for line in read(fi, crack, True):
108 after += 1
109 m = crack.match(line)
110 assert m
111 addr, rc, guts = m.groups() # guts is type name here
112 if addr not in addr2rc:
113 print('??? new object created while tearing down:', line.rstrip())
114 continue
115 print(addr, end=' ')
116 if rc == addr2rc[addr]:
117 print('[%s]' % rc, end=' ')
118 else:
119 print('[%s->%s]' % (addr2rc[addr], rc), end=' ')
120 print(guts, addr2guts[addr])
121
122 print("%d objects before, %d after" % (before, after))
123
124def combine(fname):
125 with open(fname) as f:

Callers 1

combineFunction · 0.85

Calls 5

readFunction · 0.70
compileMethod · 0.45
matchMethod · 0.45
groupsMethod · 0.45
rstripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…