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: Incorrect handling of nested calss
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.1
process
Status: closed Resolution: duplicate
Dependencies: Superseder: 2to3 - does not translate urllib2 to urllib.request correctly for function/method argument
View: 7375
Assigned To: Nosy List: cesarizu, flox
Priority: normal Keywords:

Created on 2009-12-15 21:16 by cesarizu, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
doublequote.py cesarizu, 2009-12-15 21:16
Messages (3)
msg96465 - (view) Author: César Izurieta (cesarizu) Date: 2009-12-15 21:16
I was using a function that has a nested urllib.quote. I need to double 
quote a value. When running this through the 2to3 tool, the nested call 
never got substituted.

Initial:    urllib.quote(urllib.quote(s))
2to3 ouput: urllib.parse.quote(urllib.quote(s))
Expected:   urllib.parse.quote(urllib.parse.quote(s))
msg96466 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2009-12-15 21:33
It seems to behave correctly on 2.7 and 3.1 (svn versions).

$ ./python Tools/scripts/2to3 ../doublequote.py 
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored ../doublequote.py
--- ../doublequote.py (original)
+++ ../doublequote.py (refactored)
@@ -1,5 +1,5 @@
-import urllib
+import urllib.request, urllib.parse, urllib.error
 
 def doublequote(s):
-	return urllib.quote(urllib.quote(s))
+	return urllib.parse.quote(urllib.parse.quote(s))
 
RefactoringTool: Files that need to be modified:
RefactoringTool: ../doublequote.py
msg96467 - (view) Author: César Izurieta (cesarizu) Date: 2009-12-15 21:46
Thanks for testing this. I guess I'll separate those now. But it's good 
to know it is fixed in the latest version.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51769
2009-12-15 22:02:57r.david.murraysetpriority: normal
resolution: duplicate
superseder: 2to3 - does not translate urllib2 to urllib.request correctly for function/method argument
stage: resolved
2009-12-15 21:46:06cesarizusetstatus: open -> closed

messages: + msg96467
2009-12-15 21:33:12floxsetnosy: + flox
messages: + msg96466
2009-12-15 21:16:06cesarizucreate