Message127426
__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). |
|
Date |
User |
Action |
Args |
2011-01-29 15:02:32 | ncoghlan | set | recipients:
+ ncoghlan, brett.cannon, georg.brandl, terry.reedy, pitrou, vstinner, jnoller, michael.foord, brian.curtin, asksol |
2011-01-29 15:02:31 | ncoghlan | set | messageid: <1296313351.92.0.280470596608.issue10845@psf.upfronthosting.co.za> |
2011-01-29 15:02:31 | ncoghlan | link | issue10845 messages |
2011-01-29 15:02:30 | ncoghlan | create | |
|