Bug 316899

Summary: kdev-python incorrectly says that __new__ should have self as its first argument
Product: [Developer tools] kdev-python Reporter: Todd <toddrme2178>
Component: Language supportAssignee: Sven Brauch <mail>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.4.0 / 1.4.1 (stable)   
Target Milestone: 1.4.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Todd 2013-03-17 11:29:49 UTC
Pretty much all python methods should have "self" as their first argument.  One key exception, however, is __new__.  This special method is supposed to have "cls" as its first argument, since it operates on a class rather than an instance.  

However, when __new__ is properly given "cls" as its first argument, kdev-python incorrectly labels this as a problem and says that it should be "self".

Reproducible: Always

Steps to Reproduce:
1. Create a class
2. Create a "__new__" method
3. make "cls" the first argument of the __new__method
Actual Results:  
kdev-python says it should be "self"

Expected Results:  
kdev-python finds no error.

kdev-python really should label it as a problem if anything other than "cls" is the first argument in the __new__ method.
Comment 1 Sven Brauch 2013-11-26 21:27:55 UTC
Git commit 43f49dd95d5ac85f6757b4e897e43723e0881480 by Sven Brauch, on behalf of Levente Kurusa.
Committed on 26/11/2013 at 21:26.
Pushed by brauch into branch 'master'.

Fix warning if __new__ argument is called cls, not self

This patch fixes a warning on __new__ method argument complaining about
the usage of self instead of cls.
REVIEW:114084
GCI-TASK:5883312908271616

M  +19   -6    duchain/declarationbuilder.cpp
M  +21   -0    duchain/tests/pyduchaintest.cpp
M  +2    -0    duchain/tests/pyduchaintest.h

http://commits.kde.org/kdev-python/43f49dd95d5ac85f6757b4e897e43723e0881480