homepage

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: fixer for sys.exitfunc -> atexit
Type: enhancement Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: alexandre.vassalotti, aronacher, benjamin.peterson, brett.cannon, collinwinter, jafo
Priority: critical Keywords: needs review, patch

Created on 2008年03月17日 19:37 by brett.cannon, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
atexit_fixer.patch benjamin.peterson, 2008年08月25日 19:52
fix_exitfunc.diff aronacher, 2008年12月08日 11:55
sys_exitfunc_warning.diff alexandre.vassalotti, 2009年07月05日 07:46
Messages (13)
msg63731 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008年03月17日 19:37
sys.exitfunc should raise a Py3K warning when set/used.
msg63746 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008年03月17日 19:58
A fixer to use the atexit module is needed.
msg71602 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008年08月21日 03:21
Actually, a fixer probably won't work since that would require the
atexit module to be imported.
msg71642 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008年08月21日 13:43
This is going to be very hard to implement without module descriptors.
It might be better to make a 2to3 fixer which inserts an import too.
msg71666 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008年08月21日 18:21
On Thu, Aug 21, 2008 at 6:43 AM, Benjamin Peterson
<report@bugs.python.org> wrote:
>
> Benjamin Peterson <musiccomposition@gmail.com> added the comment:
>
> This is going to be very hard to implement without module descriptors.
> It might be better to make a 2to3 fixer which inserts an import too.
>
So for every sys import you are going to add an "import atexit"? That
doesn't seem reasonable. And if the call is in an expression context
you definitely cannot add the import.
msg71668 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008年08月21日 18:45
On Thu, Aug 21, 2008 at 1:21 PM, Brett Cannon <report@bugs.python.org> wrote:
>
> So for every sys import you are going to add an "import atexit"? That
> doesn't seem reasonable. And if the call is in an expression context
> you definitely cannot add the import.
You're right; it's not going to be perfect, but 2to3 could warn when
it couldn't insert the import statement.
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2356>
> _______________________________________
>
msg71670 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008年08月21日 18:51
On Thu, Aug 21, 2008 at 11:45 AM, Benjamin Peterson
<report@bugs.python.org> wrote:
>
> Benjamin Peterson <musiccomposition@gmail.com> added the comment:
>
> On Thu, Aug 21, 2008 at 1:21 PM, Brett Cannon <report@bugs.python.org> wrote:
>>
>> So for every sys import you are going to add an "import atexit"? That
>> doesn't seem reasonable. And if the call is in an expression context
>> you definitely cannot add the import.
>
> You're right; it's not going to be perfect, but 2to3 could warn when
> it couldn't insert the import statement.
>>
OK, I can live with that.
msg71950 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008年08月25日 19:52
Here's my 2to3 fixer for the cause. It always changes assignment to
sys.exitfunc to atexit.register. It then inserts a "import atexit" after
the module's sys import. If it can't find a sys import (that should be
rare obviously :) ), it emits a warning.
msg77299 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2008年12月08日 11:55
Since yesterday there is a handy little helper that adds imports to
files which is already used for the reduce() / intern() fixers. This
makes this fix a lot easier.
I attached a version that does that.
However the import adder is not yet as sophisticated as the one in the
previous patch, but the utility method could be improved to better adapt
to existing styleguides.
msg90146 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009年07月05日 07:46
Here is an attempt to add a Py3K warning when sys.exitfunc is modified.
msg101358 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2010年03月20日 02:41
I've posted to python-dev asking for a reviewer for this, the thread is at http://mail.python.org/pipermail/python-dev/2010-March/098597.html 
msg101359 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010年03月20日 02:44
Sean, are you referring to the warning or the 2to3 fixer?
msg101376 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010年03月20日 16:13
Committed the 2to3 fixer in r79137.
History
Date User Action Args
2022年04月11日 14:56:32adminsetgithub: 46609
2010年03月20日 16:13:02benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg101376
2010年03月20日 02:44:52benjamin.petersonsetassignee: collinwinter -> benjamin.peterson
2010年03月20日 02:44:38benjamin.petersonsetmessages: + msg101359
2010年03月20日 02:41:41jafosetnosy: + jafo
messages: + msg101358
2009年07月05日 07:46:53alexandre.vassalottisetfiles: + sys_exitfunc_warning.diff
nosy: + alexandre.vassalotti
messages: + msg90146

2008年12月08日 11:55:57aronachersetfiles: + fix_exitfunc.diff
nosy: + aronacher
messages: + msg77299
2008年08月25日 19:52:59benjamin.petersonsetfiles: + atexit_fixer.patch
assignee: collinwinter
type: enhancement
components: + 2to3 (2.x to 3.x conversion tool), - Interpreter Core
title: sys.exitfunc should raise a Py3K warning -> fixer for sys.exitfunc -> atexit
keywords: + needs review, patch, - 26backport
nosy: + collinwinter
messages: + msg71950
2008年08月21日 18:51:35brett.cannonsetmessages: + msg71670
2008年08月21日 18:45:16benjamin.petersonsetmessages: + msg71668
2008年08月21日 18:21:09brett.cannonsetmessages: + msg71666
2008年08月21日 13:43:16benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg71642
2008年08月21日 03:21:06brett.cannonsetmessages: + msg71602
2008年03月17日 20:18:08brett.cannonsetpriority: release blocker -> critical
2008年03月17日 19:58:51brett.cannonsetmessages: + msg63746
2008年03月17日 19:37:31brett.cannoncreate

AltStyle によって変換されたページ (->オリジナル) /