This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jhrmnn
Recipients jhrmnn, josh.r
Date 2018-10-23.14:56:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540306582.07.0.788709270274.issue34947@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2018-10-23 14:56:22jhrmnnsetrecipients: + jhrmnn, josh.r
2018-10-23 14:56:22jhrmnnsetmessageid: <1540306582.07.0.788709270274.issue34947@psf.upfronthosting.co.za>
2018-10-23 14:56:22jhrmnnlinkissue34947 messages
2018-10-23 14:56:22jhrmnncreate