Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pydoc.Helper
for
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = None created_at = <Date 2022-01-27.11:40:53.011> labels = ['type-bug', 'library', '3.11'] title = '`pydoc.Helper` leaks several `for` loop variables' updated_at = <Date 2022-01-27.11:43:23.166> user = 'https://github.com/sobolevn'
bugs.python.org fields:
activity = <Date 2022-01-27.11:43:23.166> actor = 'sobolevn' assignee = 'none' closed = False closed_date = None closer = None components = ['Library (Lib)'] creation = <Date 2022-01-27.11:40:53.011> creator = 'sobolevn' dependencies = [] files = [] hgrepos = [] issue_num = 46547 keywords = ['patch'] message_count = 1.0 messages = ['411856'] nosy_count = 1.0 nosy_names = ['sobolevn'] pr_nums = ['30957'] priority = 'normal' resolution = None stage = 'patch review' status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue46547' versions = ['Python 3.11']
The text was updated successfully, but these errors were encountered:
Here's the problem. pydoc.Helper is defined as:
class Helper: for topic, symbols_ in _symbols_inverse.items(): for symbol in symbols_: topics = symbols.get(symbol, topic) if topic not in topics: topics = topics + ' ' + topic symbols[symbol] = topics
Link:
cpython/Lib/pydoc.py
Lines 1877 to 1882 in 08c0ed2
It causes some unwanted consequences: topic, symbols_, symbol are leaking to the class's namespace. Example:
topic, symbols_, symbol
>>> import pydoc >>> pydoc.Helper.symbol 'J' >>> pydoc.Helper.topic 'COMPLEX' >>> pydoc.Helper.symbols_ ('j', 'J')
There's also topics var, but it is shadowed later.
topics
So, I propose deleting all intermediate variables right after the for loop.
Sorry, something went wrong.
cb6c664
No branches or pull requests
pydoc.Helper
namespace #30957Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: