Noitul <qaza...@gmail.com> added the comment:
Look at this https://github.com/python/cpython/blob/3.6/Lib/inspect.py#L1412 We are taking names from func.__code__.co_names, which also contains names of object's attributes we visited. As a result, we may get more names unexpectedly in 'globals', 'builtins', and even 'unbound'. And this example might be another case of this potentially bug >>> import inspect >>> def abc(): ... import os ... sys = None ... >>> inspect.getclosurevars(abc) ClosureVars(nonlocals={}, globals={}, builtins={}, unbound={'os'}) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36697> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com