Move function_name extraction up in pycomedi/_error.pyx's comedi_get.
authorW. Trevor King <wking@drexel.edu>
Thu, 8 Mar 2012 19:51:24 +0000 (14:51 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 8 Mar 2012 19:51:24 +0000 (14:51 -0500)
This avoids:
  pycomedi/_error.pyx:43:29:
    local variable 'function_name' referenced before assignment

pycomedi/_error.pyx

index 8a49addfa95f508cb6d27ed7afecc8822be2d12d..6a2245c40065e962faf22ade3d8db620c0e203fb 100644 (file)
@@ -50,14 +50,14 @@ def _comedi_getter(name, is_invalid):
     # Hmm, cannot get function by name, or pass differing function pointers...
     #def comedi_get(function_name, *args, **kwargs):
     def comedi_get(function, *args, **kwargs):
+        #fn = getattr(_comedilib_h, function_name)
+        fn = function  # workaround until I get getattr() working
+        function_name = function.__name__
         if 'error_msg' in kwargs:
             error_msg = kwargs.pop('error_msg')
         else:
             error_msg = 'error while running %s with %s and %s' % (
                 function_name, args, kwargs)
-        #fn = getattr(_comedilib_h, function_name)
-        fn = function  # workaround until I get getattr() working
-        function_name = function.__name__
 
         _LOG.debug('calling %s with %s %s' % (function_name, args, kwargs))