Skip to content
Myr

postpone referencing sys.modules["__main"] in click.utils._detect_program_name

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Adrian Garcia Badaracco · committed by David Lord · parent 5ba2320 · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:src/click/utils.py+4 added-1 removed
473 unmodified lines
474 return getattr(self.wrapped, attr)475476477def _detect_program_name(478 path: t.Optional[str] = None, _main: ModuleType = sys.modules["__main__"]478 path: t.Optional[str] = None, _main: t.Optional[ModuleType] = None479) -> str:480 """Determine the command used to run the program, for use in help481 text. If a file or entry point was executed, the file name is482 returned. If ``python -m`` was used to execute a module or package,
13 unmodified lines
496 Based on command args detection in the Werkzeug reloader.497498 :meta private:499 """500 if _main is None:501 _main = sys.modules["__main__"]502503 if not path:504 path = sys.argv[0]505506 # The value of __package__ indicates how Python was called. It may
74 unmodified lines