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

Function _dump_unresolved

Tools/c-analyzer/c_analyzer/analyze.py:239–311  ·  view source on GitHub ↗
(decl, types, analyze_decl)

Source from the content-addressed store, hash-verified

237
238
239def _dump_unresolved(decl, types, analyze_decl):
240 if isinstance(decl, str):
241 typespec = decl
242 decl, = (d for d in types if d.shortkey == typespec)
243 elif type(decl) is tuple:
244 filename, typespec = decl
245 if '-' in typespec:
246 found = [d for d in types
247 if d.shortkey == typespec and d.filename == filename]
248 #if not found:
249 # raise NotImplementedError(decl)
250 decl, = found
251 else:
252 found = [d for d in types if d.shortkey == typespec]
253 if not found:
254 print(f'*** {typespec} ???')
255 return
256 #raise NotImplementedError(decl)
257 else:
258 decl, = found
259 resolved = analyze_decl(decl)
260 if resolved:
261 typedeps, _ = resolved or (None, None)
262
263 if decl.kind is KIND.STRUCT or decl.kind is KIND.UNION:
264 print(f'*** {decl.shortkey} {decl.filename}')
265 for member, mtype in zip(decl.members, typedeps):
266 typespec = member.vartype.typespec
267 if typespec == decl.shortkey:
268 print(f' ~~~~: {typespec:20} - {member!r}')
269 continue
270 status = None
271 if is_pots(typespec):
272 mtype = typespec
273 status = 'okay'
274 elif is_system_type(typespec):
275 mtype = typespec
276 status = 'okay'
277 elif mtype is None:
278 if '-' in member.vartype.typespec:
279 mtype, = [d for d in types
280 if d.shortkey == member.vartype.typespec
281 and d.filename == decl.filename]
282 else:
283 found = [d for d in types
284 if d.shortkey == typespec]
285 if not found:
286 print(f' ???: {typespec:20}')
287 continue
288 mtype, = found
289 if status is None:
290 status = 'okay' if types.get(mtype) else 'oops'
291 if mtype is _SKIPPED:
292 status = 'okay'
293 mtype = '<skipped>'
294 elif isinstance(mtype, FuncPtr):
295 status = 'okay'
296 mtype = str(mtype.vartype)

Callers 1

_handle_unresolvedFunction · 0.85

Calls 9

is_potsFunction · 0.90
is_funcptrFunction · 0.90
is_system_typeFunction · 0.85
strFunction · 0.85
analyze_declFunction · 0.70
getMethod · 0.45
rstripMethod · 0.45
rpartitionMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…