bpo-30166: Import command-line parsing modules only when needed. (#1293)

This commit is contained in:
Serhiy Storchaka 2017-05-04 08:17:47 +03:00 committed by GitHub
parent 1c4670ea0c
commit 7e4db2f253
7 changed files with 20 additions and 12 deletions

View file

@ -25,10 +25,8 @@
import sys
import os
import time
import marshal
from optparse import OptionParser
__all__ = ["run", "runctx", "Profile"]
@ -179,7 +177,7 @@ class Profile:
self.t = self.get_time()
self.simulate_call('profiler')
# Heavily optimized dispatch routine for os.times() timer
# Heavily optimized dispatch routine for time.process_time() timer
def trace_dispatch(self, frame, event, arg):
timer = self.timer
@ -552,6 +550,9 @@ class Profile:
#****************************************************************************
def main():
import os
from optparse import OptionParser
usage = "profile.py [-o output_file_path] [-s sort] scriptfile [arg] ..."
parser = OptionParser(usage=usage)
parser.allow_interspersed_args = False