[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread miss-islington
miss-islington added the comment: New changeset 717f1668b3455b498424577e194719f9beae13a1 by Miss Islington (bot) in branch '3.7': bpo-40196: Fix a bug in the symtable when reporting inspecting global variables (GH-19391) https://github.com/python/cpython/commit/717f1668b3455b498424577e194719

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 8bd84e7f79a6cc7670a89a92edba3015aa781758 by Miss Islington (bot) in branch '3.8': bpo-40196: Fix a bug in the symtable when reporting inspecting global variables (GH-19391) (GH-19394) https://github.com/python/cpython/commit/8bd84e7f79a6

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +18757 pull_request: https://github.com/python/cpython/pull/19395 ___ Python tracker ___ __

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 2.0 -> 3.0 pull_requests: +18756 pull_request: https://github.com/python/cpython/pull/19394 ___ Python tracker _

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 799d7d61a91eb0ad3256ef9a45a90029cef93b7c by Pablo Galindo in branch 'master': bpo-40196: Fix a bug in the symtable when reporting inspecting global variables (GH-19391) https://github.com/python/cpython/commit/799d7d61a91eb0ad3256ef9a45a

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > In symtable.Function.get_locals() symbols with scopes in (LOCAL, CELL) are > selected. Thanks for pointing that out. I will simplify PR 19391. -- ___ Python tracker _

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- Removed message: https://bugs.python.org/msg365854 ___ Python tracker ___ ___ Python-bugs-list

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I prefer to explicitly check for absence of the global scope as in PR 19391 -- ___ Python tracker ___

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Wolfgang Stöcher
Wolfgang Stöcher 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

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- Removed message: https://bugs.python.org/msg365843 ___ Python tracker ___ ___ Python-bugs-list

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: That fix is not correct. For instance consider: >>> code2 = """\ ... def foo(): ...x = 42 ...def bar(): ... return -1 ... """ >>> top.get_children()[0] >>> top = symtable.symtable(code2, "?", "exec") >>> top.get_children()[0].lookup('x').

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +18753 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19391 ___ Python tracker __

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: >>> code2 = """\ ... def foo(): ...x = 42 ...def bar(): ... return -1 ... """ >>> top.get_children()[0] >>> top = symtable.symtable(code2, "?", "exec") >>> top.get_children()[0].lookup('x')._Symbol__scope == symtable.LOCAL True but if we

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-06 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- assignee: -> pablogsal nosy: +pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-05 Thread Wolfgang Stöcher
Wolfgang Stöcher added the comment: see https://stackoverflow.com/a/61040435/1725562 for a proposed fix -- type: -> behavior ___ Python tracker ___ ___

[issue40196] symtable.Symbol.is_local() can be True for global symbols

2020-04-05 Thread Wolfgang Stöcher
New submission from Wolfgang Stöcher : Consider this function: def f(): global e e = 1 When inspecting symbols with symtable, symbol 'e' will be global and local, whereas is_local() should return False. See the attached file for reproducing. It will output to stdout: symbol '