From: INADA Naoki Date: Sat, 27 Jan 2018 01:10:06 +0000 (+0900) Subject: bpo-32678: inspect: Import ast lazily (GH-5344) X-Git-Tag: v3.7.0b1~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37420deb80dcf0fc41a728838b0340b93ca01d90;p=thirdparty%2FPython%2Fcpython.git bpo-32678: inspect: Import ast lazily (GH-5344) --- diff --git a/Lib/inspect.py b/Lib/inspect.py index b7551878b749..bc97efe179ca 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -32,7 +32,6 @@ __author__ = ('Ka-Ping Yee ', 'Yury Selivanov ') import abc -import ast import dis import collections.abc import enum @@ -1940,6 +1939,9 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True): """Private helper to parse content of '__text_signature__' and return a Signature based on it. """ + # Lazy import ast because it's relatively heavy and + # it's not used for other than this function. + import ast Parameter = cls._parameter_cls