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.

Unsupported provider

classification
Title: Regression for executing packages
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: ncoghlan Nosy List: benjamin.peterson, ncoghlan, vajda
Priority: normal Keywords: patch

Created on 2008-10-24 18:44 by vajda, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.2751.diff vajda, 2008-10-24 18:44 patch to runpy.py
issue4195_runpy_package_support.diff ncoghlan, 2008-10-25 06:25 Updated patch with test cases and doc updates
Messages (4)
msg75175 - (view) Author: vajda (vajda) Date: 2008-10-24 18:44
Copy of #2751.

Having discussed this with Nick a bit more over email, he suggested that
package execution could actually be properly supported by looking for a
__main__ module inside the package and executing it instead. This is
consistent with the way .zip archives are executed and would neatly
resolve this problem. I attached a simple patch implementing this.

Nick also said that fixing this might be considered a new feature and
might have to wait until 2.7. Given that this worked on Python 2.5,
albeit unintentionally, I'd argue that this is closer to a fix of a
somewhat buggy Python 2.5 feature than a new feature in 2.6.
msg75203 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2008-10-25 06:25
Added revised version of patch with test cases and documentation
updates, as well as fixing a potential recursion issue with pathological
packages where __main__ was also a package)
msg76560 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2008-11-28 22:32
Missed the window for 2.6/3.0. Guido agreed on python-dev that it counts
as a new feature, so it was definitely out for the already-released 2.6,
and also wasn't really an option for the release candidate phase of 3.0.

Assigning to myself for 2.7/3.1 - I'll put it in once the 3.0
maintenance branch has been cut (so I can update both 2.x and 3.x at the
same time.

For 2.6 and 3.0 though, short run scripts such as "python -m jcc.main"
are going to be the order of the day.
msg81362 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2009-02-08 01:59
Incorporated as:
2.7: r69419
3.1: r69421
History
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48445
2009-02-08 01:59:36ncoghlansetstatus: open -> closed
resolution: accepted
messages: + msg81362
stage: resolved
2008-11-28 22:32:48ncoghlansetpriority: normal
assignee: ncoghlan
messages: + msg76560
versions: + Python 3.1, Python 2.7, - Python 2.6
2008-10-25 06:25:31ncoghlansetfiles: + issue4195_runpy_package_support.diff
keywords: + patch
messages: + msg75203
2008-10-24 18:44:58vajdacreate