FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix return type for SymbolTable.get_identifiers by pamelafox · Pull Request #8054 · python/typeshed · GitHub

Fix return type for SymbolTable.get_identifiers - #8054

Merged
srittau merged 2 commits into
python:masterfrom
pamelafox:patch-1
Jun 10, 2022
Merged

Fix return type for SymbolTable.get_identifiers#8054
srittau merged 2 commits into
python:masterfrom
pamelafox:patch-1

Conversation

Copy link
Copy Markdown
Contributor

Per my PR to cpython (python/cpython#93661), the documentation for SymbolTable.get_identifiers incorrectly says it returns a list, and thats what typeshed currently says as well.

This PR changes it to return dict_keys[str, int]

Here's code that shows get_identifiers in action:

>>> import symtable
>>> code = """
... def calc_pow(a, b):
...     return a ** b
... a = 1
... b = 2
... c = calc_pow(a,b)
... """
>>> 
>>> _st = symtable.symtable(code, "example.py", "exec")
>>> _st.get_identifiers()
dict_keys(['calc_pow', 'a', 'b', 'c'])
>>> _st.get_identifiers().mapping
mappingproxy({'calc_pow': 2066, 'a': 2066, 'b': 2066, 'c': 2050})

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks!

srittau merged commit b4c3e2c into python:master Jun 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL