Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 37420de

Browse files
authored
bpo-32678: inspect: Import ast lazily (GH-5344)
1 parent 29a7df7 commit 37420de

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/inspect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
'Yury Selivanov <[email protected]>')
3333

3434
import abc
35-
import ast
3635
import dis
3736
import collections.abc
3837
import enum
@@ -1940,6 +1939,9 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):
19401939
"""Private helper to parse content of '__text_signature__'
19411940
and return a Signature based on it.
19421941
"""
1942+
# Lazy import ast because it's relatively heavy and
1943+
# it's not used for other than this function.
1944+
import ast
19431945

19441946
Parameter = cls._parameter_cls
19451947

0 commit comments

Comments
 (0)