This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, shihai1991, vinay.sajip, vstinner
Date 2020-05-14.14:16:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589465765.71.0.519092401259.issue40275@roundup.psfhosted.org>
In-reply-to
Content
While the number of imports reduced a lot, "import test.support" still imports 98 modules. That's a lot! IMO we can reduce it a little bit more :-)

Examples of imports which could be lazy:

* faulthandler: move it into start_threads() and disable_faulthandler()
* shutil: move it into rmtree()
* bz2: move it into @requires_bz2 decorator. Is it possible? Same for zlib, gzip and lzma?


There are also tons of functions, it may be time to create even more submodules:

* support.threading_helper:

  * threading_setup()/threading_cleanup()
  * reap_threads()
  * wait_thread_exit()
  * join_thread()
  * catch_threading_exception context manager
  * start_threads()

* support.process_helper:
  
  * wait_process()
  * reap_children()
  * SuppressCrashReport
  * PIPE_MAX_SIZE (is it the best place for that one?)
  * args_from_interpreter_flags()
  * optim_args_from_interpreter_flags()
  * PythonSymlink

* support.file_helper: 

  * rmtree() and the related private functions
  * unlink()
  * rmdir()
  * FS_NONASCII
  * TESTFN_UNICODE, TESTFN_NONASCII, TESTFN_UNENCODABLE, TESTFN_UNDECODABLE
  * SAVEDCWD (not sure about this one)
  * TESTFN_ENCODING <= this one can be removed, it's just sys.getfilesystemencoding()
  * temp_dir()
  * change_cwd()
  * temp_cwd()
  * temp_umask()
  * create_empty_file()
  * make_bad_fd()
  * EnvironmentVarGuard (not sure about this one)
  * can_symlink(), skip_unless_symlink()
  * can_xattr(), skip_unless_xattr()
  * fs_is_case_insensitive()
  * fd_count()
  * FakePath

* support.import_helper:

  * import_module(), _ignore_deprecated_imports()
  * import_fresh_module(), _save_and_remove_module(), _save_and_block_module()
  * unload()
  * make_legacy_pyc()
  * forget()
  * CleanImport
  * DirsOnSysPath
  * modules_setup(), modules_cleanup()

* support.warnings_helper:

  * check_syntax_warning()
  * ignore_warnings()
  * WarningsRecorder
  * check_warnings(), _filterwarnings()
  * check_no_warnings()
  * check_no_resource_warning()

Move also move the following functions to socket_helper:

  * SOCK_MAX_SIZE
  * open_urlresource()
  * TransientResource
  * time_out
  * socket_peer_reset
  * ioerror_peer_reset

Serhiy: What do you think of these proposed submodules?
History
Date User Action Args
2020-05-14 14:16:05vstinnersetrecipients: + vstinner, vinay.sajip, serhiy.storchaka, shihai1991
2020-05-14 14:16:05vstinnersetmessageid: <1589465765.71.0.519092401259.issue40275@roundup.psfhosted.org>
2020-05-14 14:16:05vstinnerlinkissue40275 messages
2020-05-14 14:16:04vstinnercreate