Jan Hermann <[email protected]> added the comment:
Ok, that’s fair. But then the inspect module currently doesn’t provide tools to
the user to construct the recursive identification without duplicating code
already in stdlib. For that, one would need to refactor getclosurevars() to two
parts: getcode() and getclosurevars_from_code(). Then one could do:
clvars = ClosureVars({}, {}, {}, set())
codes = [getcode(func)]
while codes:
code = codes.pop()
for const in code.co_consts:
if iscode(const):
codes.append(const)
lclvars = getclosurevars_from_code(code)
for v, lv in zip(clvars, lclvars):
v.update(lv)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34947>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com