Author Julian
Recipients Julian
Date 2019-08-24.17:59:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This seems brutally simple, to the point where I'm concerned I'm missing something (or have seen this issue filed elsewhere but can't find it), but `python -m` and `runpy.run_module` don't set the same __name__ -- specifically `runpy.run_module`, when given a non-package, defaults to setting __name__ to `mod_name`.

So, given package/, with the "common"

`if __name__ == "__main__":` check at the bottom, `python -m` successfully executes, but `runpy.run_module("")` exits silently, unless explicitly passed `runpy.run_module("", run_name="__main__").

[n.b. pep517.{build,check} is a specific example of such a module that advertises itself as wanting to be executed via `python -m`]

issue16737 seems related but not exactly the same from what I can tell.
Date User Action Args
2019-08-24 17:59:15Juliansetrecipients: + Julian
2019-08-24 17:59:15Juliansetmessageid: <>
2019-08-24 17:59:15Julianlinkissue37941 messages
2019-08-24 17:59:14Juliancreate