diff mercurial/commands.py @ 9035:8e34f363dd77

compat: don't reference an exception var inside a lambda
author Alejandro Santos <alejolp@alejolp.com>
date Sun, 05 Jul 2009 11:05:31 +0200
parents 3b76321aa0de
children 32e678f9045f
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Jul 05 11:04:55 2009 +0200
+++ b/mercurial/commands.py	Sun Jul 05 11:05:31 2009 +0200
@@ -1457,7 +1457,10 @@
         try:
             aliases, i = cmdutil.findcmd(name, table, False)
         except error.AmbiguousCommand, inst:
-            select = lambda c: c.lstrip('^').startswith(inst.args[0])
+            # py3k fix: except vars can't be used outside the scope of the
+            # except block, nor can be used inside a lambda. python issue4617
+            prefix = inst.args[0]
+            select = lambda c: c.lstrip('^').startswith(prefix)
             helplist(_('list of commands:\n\n'), select)
             return