Commit 6f85b826 authored by INADA Naoki's avatar INADA Naoki Committed by Miss Islington (bot)

bpo-34871: inspect: Don't pollute sys.modules (GH-9696)



https://bugs.python.org/issue34871
parent c57eb9a3
...@@ -1988,7 +1988,7 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): ...@@ -1988,7 +1988,7 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):
module = sys.modules.get(module_name, None) module = sys.modules.get(module_name, None)
if module: if module:
module_dict = module.__dict__ module_dict = module.__dict__
sys_module_dict = sys.modules sys_module_dict = sys.modules.copy()
def parse_name(node): def parse_name(node):
assert isinstance(node, ast.arg) assert isinstance(node, ast.arg)
......
Fix inspect module polluted ``sys.modules`` when parsing
``__text_signature__`` of callable.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment