Author brett.cannon
Recipients brett.cannon, j1o1h1n, ncoghlan, r.david.murray
Date 2017-01-08.19:00:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483902030.37.0.0940134020462.issue29206@psf.upfronthosting.co.za>
In-reply-to
Content
The error from using -m stems from runpy not aliasing the module as both "__main__" and "reloader". I suspect the reason is that having a module under two names gets really messy because if you update just one of those modules you leave the  other one around and then you have skewed the results.

As for your use-case, be aware that importlib.reload() is not designed for it. You will still have objects floating around in the interpreter that are using the original module and so you're not going to get all instances of objects automatically updated to the new code. The only way to guarantee usage of the new code is to restart the interpreter.

I get why you want this, John, but Python is simply not structured to support what you're after. Closing as "won't fix".
History
Date User Action Args
2017-01-08 19:00:30brett.cannonsetrecipients: + brett.cannon, ncoghlan, r.david.murray, j1o1h1n
2017-01-08 19:00:30brett.cannonsetmessageid: <1483902030.37.0.0940134020462.issue29206@psf.upfronthosting.co.za>
2017-01-08 19:00:30brett.cannonlinkissue29206 messages
2017-01-08 19:00:30brett.cannoncreate