From e12f391106bb256741b3315ca626fc15631b9587 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 11 Aug 2019 16:03:52 +0100 Subject: [PATCH] docs: mention another __main__ safeguard --- docs/howitworks.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/howitworks.rst b/docs/howitworks.rst index e5fdee2f..20c4f948 100644 --- a/docs/howitworks.rst +++ b/docs/howitworks.rst @@ -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