summaryrefslogtreecommitdiff
path: root/Lib/types.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-09-26 00:55:55 +0300
committerGitHub <noreply@github.com>2017-09-26 00:55:55 +0300
commit81108375d9b2ccd0add1572da745311d4dfac505 (patch)
tree54632e1d6ec58850f70941452634c4faf1ea7218 /Lib/types.py
parentf1502d097c29b266a5748312ee2451a2d6ac0af6 (diff)
downloadcpython-git-81108375d9b2ccd0add1572da745311d4dfac505.tar.gz
bpo-30152: Reduce the number of imports for argparse. (#1269)
Diffstat (limited to 'Lib/types.py')
-rw-r--r--Lib/types.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/types.py b/Lib/types.py
index 929cba223a..336918fea0 100644
--- a/Lib/types.py
+++ b/Lib/types.py
@@ -172,9 +172,6 @@ class DynamicClassAttribute:
return result
-import functools as _functools
-import collections.abc as _collections_abc
-
class _GeneratorWrapper:
# TODO: Implement this in C.
def __init__(self, gen):
@@ -247,7 +244,10 @@ def coroutine(func):
# return generator-like objects (for instance generators
# compiled with Cython).
- @_functools.wraps(func)
+ # Delay functools and _collections_abc import for speeding up types import.
+ import functools
+ import _collections_abc
+ @functools.wraps(func)
def wrapped(*args, **kwargs):
coro = func(*args, **kwargs)
if (coro.__class__ is CoroutineType or