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.

classification
Title: The -m switch does not use the builtin __main__ module
Type: Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ncoghlan Nosy List: ncoghlan
Priority: normal Keywords:

Created on 2007-07-31 12:43 by ncoghlan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg32575 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2007-07-31 12:43
The -m switch creates a new module object to execute the requested module, and then throws it away before returning control to the interpreter core.

This is incompatible with the -i command line switch (and its environment variable equivalent), and would also cause problems if any code executed while looking for the module to be executed (e.g. sitecustomize.py or package __init__ modules) grabbed a reference to the original __main__ module.

(Creating bug report because I don't think the quick fix I checked in to SVN is adequate, and it's taking me longer than I planned to roll the quick fix back and fix the problem properly)
msg55286 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2007-08-25 10:52
Fixed committed to SVN as r57461
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45260
2007-08-25 10:52:06ncoghlansetstatus: open -> closed
resolution: fixed
messages: + msg55286
2007-07-31 12:43:51ncoghlancreate