Bug 316899 - kdev-python incorrectly says that __new__ should have self as its first argument
Summary: kdev-python incorrectly says that __new__ should have self as its first argument
Status: RESOLVED FIXED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: Language support (show other bugs)
Version: 1.4.0 / 1.4.1 (stable)
Platform: Other Linux
: NOR normal
Target Milestone: 1.4.0
Assignee: Sven Brauch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-17 11:29 UTC by Todd
Modified: 2013-11-26 21:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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