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: sys.intern() 2to3 fixer
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: georg.brandl, gvanrossum
Priority: normal Keywords: patch

Created on 2006-12-19 20:54 by georg.brandl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
2to3-intern.diff georg.brandl, 2006-12-19 20:54
2to3-intern-2.diff georg.brandl, 2006-12-19 21:24
Messages (5)
msg51580 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-12-19 20:54
This is a fixer for the 2to3 refactoring utility, replacing occurences of intern() by sys.intern().
msg51581 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2006-12-19 21:06
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?
msg51582 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-12-19 21:24
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
msg51583 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2006-12-19 21:39
OK, check it in.

We need to figure out one more thing eventually -- how to insert the needed "import sys" if it isn't there already.  But let's put that off a bit.
msg51584 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-12-19 21:44
Okay, applied as rev. 53088.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44362
2008-01-06 22:29:46adminsetkeywords: - py3k
versions: + Python 3.0
2007-09-06 18:03:48collinwintersetcomponents: + 2to3 (2.x to 3.x conversion tool), - None
2006-12-19 20:54:05georg.brandlcreate