docs: mention another __main__ safeguard

This commit is contained in:
David Wilson 2019-08-11 16:03:52 +01:00
parent 1d41adb346
commit e12f391106
1 changed files with 6 additions and 2 deletions

View File

@ -673,8 +673,12 @@ code occurring after the first conditional that looks like a standard
if __name__ == '__main__':
run_some_code()
This is a hack, but it's the least annoying hack I've found for the problem
yet.
To further avoid accidental execution, Mitogen will refuse to serve
:mod:`__main__` to children if no execution guard is found, as it is common
that no guard is present during early script prototyping.
These are hacks, but they are the safest and least annoying found to solve the
problem.
Avoiding Negative Imports