[Patches] [ python-Patches-1619049 ] sys.intern() 2to3 fixer

SourceForge.net noreply at sourceforge.net
Tue Dec 19 22:24:32 CET 2006


Patches item #1619049, was opened at 2006-12-19 20:54
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1619049&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Georg Brandl (gbrandl)
Assigned to: Guido van Rossum (gvanrossum)
Summary: sys.intern() 2to3 fixer

Initial Comment:
This is a fixer for the 2to3 refactoring utility, replacing occurences of intern() by sys.intern().

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-12-19 21:24

Message:
Logged In: YES 
user_id=849994
Originator: YES

Yes, I looked at fix_apply and didn't think about additional trailers.

Attaching updated patch.

I think once you get the general idea, it's fairly easy to write
refactorings.
(I was only stuck for a while figuring out that only one argument doesn't
create
an "arglist" node at all).
File Added: 2to3-intern-2.diff

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2006-12-19 21:06

Message:
Logged In: YES 
user_id=6380
Originator: NO

Pretty good.  I think you used fix_apply.py as an example?  That
unfortunately doesn't handle the following case:

  apply(f, x, y).something

The has_key() fixes *does* support that (using the "after=*any" pattern.
Can you copy the relevant parts from that fixer?

Also, what do you think of how easy it is to write a refactoring using
this tool?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1619049&group_id=5470


More information about the Patches mailing list