diff options
author | Zaheer Abbas Merali <zaheerm@gentoo.org> | 2006-09-28 14:42:07 +0000 |
---|---|---|
committer | Zaheer Abbas Merali <zaheerm@gentoo.org> | 2006-09-28 14:42:07 +0000 |
commit | e67638cdd723ac20c276616a3177e566aee4359a (patch) | |
tree | 3e4023ec9cd690d4d28b0fd87fd4ab5db9cef677 /dev-python/pychecker/files/pychecker.lambda-assign.patch | |
parent | 915resolution and vbetool, needed for macbook (diff) | |
download | zaheerm-e67638cdd723ac20c276616a3177e566aee4359a.tar.gz zaheerm-e67638cdd723ac20c276616a3177e566aee4359a.tar.bz2 zaheerm-e67638cdd723ac20c276616a3177e566aee4359a.zip |
svn path=/; revision=11
Diffstat (limited to 'dev-python/pychecker/files/pychecker.lambda-assign.patch')
-rw-r--r-- | dev-python/pychecker/files/pychecker.lambda-assign.patch | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dev-python/pychecker/files/pychecker.lambda-assign.patch b/dev-python/pychecker/files/pychecker.lambda-assign.patch new file mode 100644 index 0000000..0a8bb1e --- /dev/null +++ b/dev-python/pychecker/files/pychecker.lambda-assign.patch @@ -0,0 +1,29 @@ +Index: pychecker/pychecker/CodeChecks.py +=================================================================== +--- pychecker.orig/pychecker/CodeChecks.py ++++ pychecker/pychecker/CodeChecks.py +@@ -144,7 +144,10 @@ def _checkBuiltin(code, loadValue, argCo + (func_name == 'getattr' and argCount == 2)): + arg2 = code.stack[-argCount + 1] + if arg2.const: +- code.addWarning(msgs.USES_CONST_ATTR % func_name) ++ # lambda with setattr and const is a common way of setting ++ # attributes, so allow it ++ if code.func.function.func_name != '<lambda>': ++ code.addWarning(msgs.USES_CONST_ATTR % func_name) + + if kwArgs: + _validateKwArgs(code, info, func_name, kwArgs) +@@ -395,7 +398,11 @@ def _handleFunctionCall(codeSource, code + name = utils.safestr(loadValue.data) + if type(loadValue.data) == types.TupleType : + name = string.join(loadValue.data, '.') +- code.addWarning(msgs.USING_NONE_RETURN_VALUE % name) ++ # lambda with setattr is a common way of setting ++ # attributes, so allow it ++ if name != 'setattr' \ ++ or code.func.function.func_name != '<lambda>': ++ code.addWarning(msgs.USING_NONE_RETURN_VALUE % name) + + code.stack = code.stack[:funcIndex] + [ returnValue ] + code.functionsCalled[funcName] = loadValue |