[issue45020] Freeze all modules imported during startup.
Guido van Rossum
report at bugs.python.org
Fri Sep 17 22:48:03 EDT 2021
Guido van Rossum <guido at python.org> added the comment:
> It would be nice to freeze argparse.py and its dependencies. For command-line tools, startup time is important.
I quickly checked, and argparse has at least these dependencies:
argparse
re
enum
types
operator
functools
collections
keyword
reprlib
sre_compile
sre_parse
sre_constants
copyreg
gettext
Raymond, do you think we should also freeze the dependencies of runpy (so "python -m <module>" also starts faster)?
That would be
runpy
importlib
warnings
importlib.machinery
importlib.util
importlib._abc
contextlib
collections
keyword
operator
reprlib
functools
types
(I didn't dedupe this from the previous list.)
With all these modules frozen we'd probably run more risk of two things:
- frozen modules don't have a __file__ (and are missing a few other, less commonly used, attributes)
- editing a frozen module requires rebuilding, or running with -X frozen_modules=off
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45020>
_______________________________________
More information about the Python-bugs-list
mailing list