[Python-checkins] r83564 - in python/branches/release26-maint: Lib/cgitb.py Lib/distutils/command/build_ext.py Lib/distutils/util.py Lib/idlelib/AutoCompleteWindow.py Lib/idlelib/MultiCall.py Lib/platform.py

ezio.melotti python-checkins at python.org
Mon Aug 2 22:26:41 CEST 2010


Author: ezio.melotti
Date: Mon Aug  2 22:26:41 2010
New Revision: 83564

Log:
Merged revisions 79558 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79558 | florent.xicluna | 2010-04-01 21:17:09 +0300 (Thu, 01 Apr 2010) | 2 lines
  
  #7092: Fix some -3 warnings, and fix Lib/platform.py when the path contains a double-quote.
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/cgitb.py
   python/branches/release26-maint/Lib/distutils/command/build_ext.py
   python/branches/release26-maint/Lib/distutils/util.py
   python/branches/release26-maint/Lib/idlelib/AutoCompleteWindow.py
   python/branches/release26-maint/Lib/idlelib/MultiCall.py
   python/branches/release26-maint/Lib/platform.py

Modified: python/branches/release26-maint/Lib/cgitb.py
==============================================================================
--- python/branches/release26-maint/Lib/cgitb.py	(original)
+++ python/branches/release26-maint/Lib/cgitb.py	Mon Aug  2 22:26:41 2010
@@ -94,10 +94,10 @@
         lasttoken = token
     return vars
 
-def html((etype, evalue, etb), context=5):
+def html(einfo, context=5):
     """Return a nice HTML document describing a given traceback."""
     import os, types, time, traceback, linecache, inspect, pydoc
-
+    etype, evalue, etb = einfo
     if type(etype) is types.ClassType:
         etype = etype.__name__
     pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable
@@ -186,10 +186,10 @@
 ''' % pydoc.html.escape(
           ''.join(traceback.format_exception(etype, evalue, etb)))
 
-def text((etype, evalue, etb), context=5):
+def text(einfo, context=5):
     """Return a plain text document describing a given traceback."""
     import os, types, time, traceback, linecache, inspect, pydoc
-
+    etype, evalue, etb = einfo
     if type(etype) is types.ClassType:
         etype = etype.__name__
     pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable

Modified: python/branches/release26-maint/Lib/distutils/command/build_ext.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/command/build_ext.py	(original)
+++ python/branches/release26-maint/Lib/distutils/command/build_ext.py	Mon Aug  2 22:26:41 2010
@@ -676,7 +676,7 @@
         # extensions in debug_mode are named 'module_d.pyd' under windows
         so_ext = get_config_var('SO')
         if os.name == 'nt' and self.debug:
-            return apply(os.path.join, ext_path) + '_d' + so_ext
+            return os.path.join(*ext_path) + '_d' + so_ext
         return os.path.join(*ext_path) + so_ext
 
     def get_export_symbols (self, ext):

Modified: python/branches/release26-maint/Lib/distutils/util.py
==============================================================================
--- python/branches/release26-maint/Lib/distutils/util.py	(original)
+++ python/branches/release26-maint/Lib/distutils/util.py	Mon Aug  2 22:26:41 2010
@@ -205,7 +205,7 @@
         paths.remove('.')
     if not paths:
         return os.curdir
-    return apply(os.path.join, paths)
+    return os.path.join(*paths)
 
 # convert_path ()
 

Modified: python/branches/release26-maint/Lib/idlelib/AutoCompleteWindow.py
==============================================================================
--- python/branches/release26-maint/Lib/idlelib/AutoCompleteWindow.py	(original)
+++ python/branches/release26-maint/Lib/idlelib/AutoCompleteWindow.py	Mon Aug  2 22:26:41 2010
@@ -349,10 +349,8 @@
                 self.lastkey_was_tab = True
                 return
 
-        elif reduce(lambda x, y: x or y,
-                    [keysym.find(s) != -1 for s in ("Shift", "Control", "Alt",
-                                                    "Meta", "Command", "Option")
-                     ]):
+        elif any(s in keysym for s in ("Shift", "Control", "Alt",
+                                       "Meta", "Command", "Option")):
             # A modifier key, so ignore
             return
 

Modified: python/branches/release26-maint/Lib/idlelib/MultiCall.py
==============================================================================
--- python/branches/release26-maint/Lib/idlelib/MultiCall.py	(original)
+++ python/branches/release26-maint/Lib/idlelib/MultiCall.py	Mon Aug  2 22:26:41 2010
@@ -107,10 +107,9 @@
 # a list of the states which are a subset of it. This list is ordered by the
 # number of modifiers is the state - the most specific state comes first.
 _states = range(1 << len(_modifiers))
-_state_names = [reduce(lambda x, y: x + y,
-                       [_modifiers[i][0]+'-' for i in range(len(_modifiers))
-                        if (1 << i) & s],
-                       "")
+_state_names = [''.join(m[0]+'-'
+                        for i, m in enumerate(_modifiers)
+                        if (1 << i) & s)
                 for s in _states]
 _state_subsets = map(lambda i: filter(lambda j: not (j & (~i)), _states),
                       _states)
@@ -119,11 +118,13 @@
                                                       range(len(_modifiers)))):
            nummod(b) - nummod(a))
 # _state_codes gives for each state, the portable code to be passed as mc_state
-_state_codes = [reduce(lambda x, y: x | y,
-                       [_modifier_masks[i] for i in range(len(_modifiers))
-                        if (1 << i) & s],
-                       0)
-                for s in _states]
+_state_codes = []
+for s in _states:
+    r = 0
+    for i in range(len(_modifiers)):
+        if (1 << i) & s:
+            r |= _modifier_masks[i]
+    _state_codes.append(r)
 
 class _ComplexBinder:
     # This class binds many functions, and only unbinds them when it is deleted.

Modified: python/branches/release26-maint/Lib/platform.py
==============================================================================
--- python/branches/release26-maint/Lib/platform.py	(original)
+++ python/branches/release26-maint/Lib/platform.py	Mon Aug  2 22:26:41 2010
@@ -1012,7 +1012,7 @@
     if sys.platform in ('dos','win32','win16','os2'):
         # XXX Others too ?
         return default
-    target = _follow_symlinks(target)
+    target = _follow_symlinks(target).replace('"', '\\"')
     try:
         f = os.popen('file "%s" 2> /dev/null' % target)
     except (AttributeError,os.error):
@@ -1078,13 +1078,13 @@
        executable == sys.executable:
         # "file" command did not return anything; we'll try to provide
         # some sensible defaults then...
-        if _default_architecture.has_key(sys.platform):
-            b,l = _default_architecture[sys.platform]
+        if sys.platform in _default_architecture:
+            b, l = _default_architecture[sys.platform]
             if b:
                 bits = b
             if l:
                 linkage = l
-        return bits,linkage
+        return bits, linkage
 
     # Split the output into a list of strings omitting the filename
     fileout = _architecture_split(output)[1:]


More information about the Python-checkins mailing list