New submission from CendioOssman <oss...@cendio.se>:

So Issue40196 (and PR 19391) broke things for us here as Symbol.is_local() no 
longer works properly for symbols on the global/module scope.

Previously it would return True for all global symbols that were bound. Now it 
only returns True when the symbol is not used in any other scope. This means we 
cannot tell the difference between globals that are from the module itself, and 
globals that come in via imports.

This also seems to contradict this part of the language reference:

"(The variables of the module code block are local and global.)"

https://docs.python.org/3/reference/executionmodel.html

I don't see any clean workaround as there is no Symbol.is_bound() that could be 
used instead.

(inb4 https://xkcd.com/1172/)

----------
components: Library (Lib)
messages: 377373
nosy: CendioOssman
priority: normal
severity: normal
status: open
title: [regression] symtable.Symbol.is_local() is no longer True for bound 
global symbols
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41840>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to