[Python-checkins] cpython: Cleanup: move code out of a try block

eric.araujo python-checkins at python.org
Tue Aug 30 16:22:13 CEST 2011


http://hg.python.org/cpython/rev/e4576486544c
changeset:   72126:e4576486544c
user:        Éric Araujo <merwok at netwok.org>
date:        Tue Aug 30 00:45:59 2011 +0200
summary:
  Cleanup: move code out of a try block

files:
  Lib/packaging/command/__init__.py |  10 ++++++----
  1 files changed, 6 insertions(+), 4 deletions(-)


diff --git a/Lib/packaging/command/__init__.py b/Lib/packaging/command/__init__.py
--- a/Lib/packaging/command/__init__.py
+++ b/Lib/packaging/command/__init__.py
@@ -30,6 +30,8 @@
     'upload': 'packaging.command.upload.upload',
     'upload_docs': 'packaging.command.upload_docs.upload_docs'}
 
+# XXX use OrderedDict to preserve the grouping (build-related, install-related,
+# distribution-related)
 STANDARD_COMMANDS = set(_COMMANDS)
 
 
@@ -48,9 +50,9 @@
     """Return the registered command"""
     try:
         cls = _COMMANDS[name]
-        if isinstance(cls, str):
-            cls = resolve_name(cls)
-            _COMMANDS[name] = cls
-        return cls
     except KeyError:
         raise PackagingModuleError("Invalid command %s" % name)
+    if isinstance(cls, str):
+        cls = resolve_name(cls)
+        _COMMANDS[name] = cls
+    return cls

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list