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 ncoghlan
Recipients asksol, brett.cannon, brian.curtin, georg.brandl, jnoller, michael.foord, ncoghlan, pitrou, terry.reedy, vstinner
Date 2011-01-29.15:02:30
SpamBayes Score 8.8558187e-07
Marked as misclassified No
Message-id <1296313351.92.0.280470596608.issue10845@psf.upfronthosting.co.za>
In-reply-to
Content
__main__.py files aren't like ordinary modules - they should *not* be defining classes or anything like that. Instead, they should be treated as if the entire file was implicitly inside an "if __name__ == '__main__':" clause - when "imported" they don't do anything.

That's why Antoine's patch set off alarm bells in my head - no normal __main__.py will include an explicit "if __name__ == '__main__':" check, so multiprocessing should just skip the file completely instead.

There's no doubt that either approach is a hack that will sometimes fail to work, but I think skipping the file execution completely will be the right decision most of the time (and we can easily say "don't do that then" if people rely on class definitions in __main__.py files).
History
Date User Action Args
2011-01-29 15:02:32ncoghlansetrecipients: + ncoghlan, brett.cannon, georg.brandl, terry.reedy, pitrou, vstinner, jnoller, michael.foord, brian.curtin, asksol
2011-01-29 15:02:31ncoghlansetmessageid: <1296313351.92.0.280470596608.issue10845@psf.upfronthosting.co.za>
2011-01-29 15:02:31ncoghlanlinkissue10845 messages
2011-01-29 15:02:30ncoghlancreate