[Python-checkins] r68423 - in python/trunk/Lib/lib2to3: fixes/fix_imports.py fixes/fix_imports2.py fixes/fix_urllib.py pgen2/driver.py

benjamin.peterson python-checkins at python.org
Fri Jan 9 03:13:35 CET 2009


Author: benjamin.peterson
Date: Fri Jan  9 03:13:34 2009
New Revision: 68423

Log:
Merged revisions 68306-68308,68340,68368,68422 via svnmerge from 
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r68306 | benjamin.peterson | 2009-01-04 12:27:19 -0600 (Sun, 04 Jan 2009) | 1 line
  
  fix_urllib: add mappings for the url parsing functions
........
  r68307 | benjamin.peterson | 2009-01-04 12:30:01 -0600 (Sun, 04 Jan 2009) | 1 line
  
  remove duplicated function
........
  r68308 | benjamin.peterson | 2009-01-04 12:50:34 -0600 (Sun, 04 Jan 2009) | 1 line
  
  turtle is no longer renamed
........
  r68340 | georg.brandl | 2009-01-05 02:11:39 -0600 (Mon, 05 Jan 2009) | 2 lines
  
  Fix undefined locals in parse_tokens().
........
  r68368 | benjamin.peterson | 2009-01-06 17:56:10 -0600 (Tue, 06 Jan 2009) | 1 line
  
  fix typo (thanks to Robert Lehmann)
........
  r68422 | benjamin.peterson | 2009-01-08 20:01:03 -0600 (Thu, 08 Jan 2009) | 1 line
  
  run the imports fixers after fix_import, so fix_import doesn't try to make stdlib renames into relative imports #4876
........


Modified:
   python/trunk/Lib/lib2to3/   (props changed)
   python/trunk/Lib/lib2to3/fixes/fix_imports.py
   python/trunk/Lib/lib2to3/fixes/fix_imports2.py
   python/trunk/Lib/lib2to3/fixes/fix_urllib.py
   python/trunk/Lib/lib2to3/pgen2/driver.py

Modified: python/trunk/Lib/lib2to3/fixes/fix_imports.py
==============================================================================
--- python/trunk/Lib/lib2to3/fixes/fix_imports.py	(original)
+++ python/trunk/Lib/lib2to3/fixes/fix_imports.py	Fri Jan  9 03:13:34 2009
@@ -25,7 +25,6 @@
            'tkFont': 'tkinter.font',
            'tkMessageBox': 'tkinter.messagebox',
            'ScrolledText': 'tkinter.scrolledtext',
-           'turtle': 'tkinter.turtle',
            'Tkconstants': 'tkinter.constants',
            'Tix': 'tkinter.tix',
            'Tkinter': 'tkinter',
@@ -89,6 +88,10 @@
     # This is overridden in fix_imports2.
     mapping = MAPPING
 
+    # We want to run this fixer late, so fix_import doesn't try to make stdlib
+    # renames into relative imports.
+    run_order = 6
+
     def build_pattern(self):
         return "|".join(build_pattern(self.mapping))
 

Modified: python/trunk/Lib/lib2to3/fixes/fix_imports2.py
==============================================================================
--- python/trunk/Lib/lib2to3/fixes/fix_imports2.py	(original)
+++ python/trunk/Lib/lib2to3/fixes/fix_imports2.py	Fri Jan  9 03:13:34 2009
@@ -11,6 +11,6 @@
 
 class FixImports2(fix_imports.FixImports):
 
-    run_order = 6
+    run_order = 7
 
     mapping = MAPPING

Modified: python/trunk/Lib/lib2to3/fixes/fix_urllib.py
==============================================================================
--- python/trunk/Lib/lib2to3/fixes/fix_urllib.py	(original)
+++ python/trunk/Lib/lib2to3/fixes/fix_urllib.py	Fri Jan  9 03:13:34 2009
@@ -15,7 +15,10 @@
                      '_urlopener', 'urlcleanup']),
                 ('urllib.parse',
                     ['quote', 'quote_plus', 'unquote', 'unquote_plus',
-                     'urlencode', 'pahtname2url', 'url2pathname']),
+                     'urlencode', 'pathname2url', 'url2pathname', 'splitattr',
+                     'splithost', 'splitnport', 'splitpasswd', 'splitport',
+                     'splitquery', 'splittag', 'splittype', 'splituser',
+                     'splitvalue', ]),
                 ('urllib.error',
                     ['ContentTooShortError'])],
            'urllib2' : [
@@ -34,12 +37,12 @@
                      'FTPHandler', 'CacheFTPHandler',
                      'UnknownHandler']),
                 ('urllib.error',
-                    ['URLError', 'HTTPError'])],
+                    ['URLError', 'HTTPError']),
+           ]
 }
 
-
-# def alternates(members):
-#     return "(" + "|".join(map(repr, members)) + ")"
+# Duplicate the url parsing functions for urllib2.
+MAPPING["urllib2"].append(MAPPING["urllib"][1])
 
 
 def build_pattern():

Modified: python/trunk/Lib/lib2to3/pgen2/driver.py
==============================================================================
--- python/trunk/Lib/lib2to3/pgen2/driver.py	(original)
+++ python/trunk/Lib/lib2to3/pgen2/driver.py	Fri Jan  9 03:13:34 2009
@@ -77,7 +77,8 @@
                 column = 0
         else:
             # We never broke out -- EOF is too soon (how can this happen???)
-            raise parse.ParseError("incomplete input", t, v, x)
+            raise parse.ParseError("incomplete input",
+                                   type, value, (prefix, start))
         return p.rootnode
 
     def parse_stream_raw(self, stream, debug=False):


More information about the Python-checkins mailing list