From: W. Trevor King Date: Thu, 8 Mar 2012 19:51:24 +0000 (-0500) Subject: Move function_name extraction up in pycomedi/_error.pyx's comedi_get. X-Git-Tag: 0.4~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c258d1bb580874a58e4b9cf14e36517084ae380f;p=pycomedi.git Move function_name extraction up in pycomedi/_error.pyx's comedi_get. This avoids: pycomedi/_error.pyx:43:29: local variable 'function_name' referenced before assignment --- diff --git a/pycomedi/_error.pyx b/pycomedi/_error.pyx index 8a49add..6a2245c 100644 --- a/pycomedi/_error.pyx +++ b/pycomedi/_error.pyx @@ -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))