[New-bugs-announce] [issue41840] [regression] symtable.Symbol.is_local() is no longer True for bound global symbols

CendioOssman report at bugs.python.org
Wed Sep 23 08:22:04 EDT 2020


New submission from CendioOssman <ossman at 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 <report at bugs.python.org>
<https://bugs.python.org/issue41840>
_______________________________________


More information about the New-bugs-announce mailing list