Issue 42355: symtable: get_namespace doesn't check whether if there are multiple namespaces or no namespaces at all - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: BTaskaya Nosy List: BTaskaya, benjamin.peterson
Priority: normal Keywords: patch

Created on 2020-11-14 10:27 by BTaskaya, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23278 merged BTaskaya, 2020-11-14 10:35
Messages (2)
msg380969 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2020-11-14 10:27
>>> table = symtable.symtable("A = 1", "<string>", "exec")
>>> table.lookup("A")
<symbol 'A'>
>>> table.lookup("A").get_namespace()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/symtable.py", line 312, in get_namespace
    raise ValueError("name is bound to multiple namespaces")
ValueError: name is bound to multiple namespaces
>>> table.lookup("A").get_namespaces()
()
msg397748 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2021-07-18 12:56
New changeset a045991f60b51636a784623dda7ad84b5b2c6b73 by Batuhan Taskaya in branch 'main':
bpo-42355: symtable.get_namespace() now checks whether there are multiple or any namespaces found (GH-23278)
https://github.com/python/cpython/commit/a045991f60b51636a784623dda7ad84b5b2c6b73