diff options
-rw-r--r-- | Lib/inspect.py | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-10-04-18-46-54.bpo-34871.t3X-dB.rst | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 5b7f526..857892b 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1988,7 +1988,7 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): module = sys.modules.get(module_name, None) if module: module_dict = module.__dict__ - sys_module_dict = sys.modules + sys_module_dict = sys.modules.copy() def parse_name(node): assert isinstance(node, ast.arg) diff --git a/Misc/NEWS.d/next/Library/2018-10-04-18-46-54.bpo-34871.t3X-dB.rst b/Misc/NEWS.d/next/Library/2018-10-04-18-46-54.bpo-34871.t3X-dB.rst new file mode 100644 index 0000000..8cff156 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-10-04-18-46-54.bpo-34871.t3X-dB.rst @@ -0,0 +1,2 @@ +Fix inspect module polluted ``sys.modules`` when parsing +``__text_signature__`` of callable. |