bpo-30166: Import command-line parsing modules only when needed. (#1293)
diff --git a/Lib/code.py b/Lib/code.py
index 23295f4..d8106ae 100644
--- a/Lib/code.py
+++ b/Lib/code.py
@@ -7,7 +7,6 @@
import sys
import traceback
-import argparse
from codeop import CommandCompiler, compile_command
__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact",
@@ -303,6 +302,8 @@
if __name__ == "__main__":
+ import argparse
+
parser = argparse.ArgumentParser()
parser.add_argument('-q', action='store_true',
help="don't print version and copyright messages")