Wolfgang Stöcher <wolfg...@stoecher.com> added the comment: In symtable.Function.get_locals() symbols with scopes in (LOCAL, CELL) are selected. Also
>>> code = """\ ... def foo(): ... x = 42 ... def bar(): ... return x ... """ >>> import symtable >>> top = symtable.symtable(code, "?", "exec") >>> top.get_children()[0].lookup('x')._Symbol__scope == symtable.CELL True So I guess this would be the correct fix then: def is_local(self): return self.__scope in (LOCAL, CELL) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40196> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com