Possible bug: False negative for W0613 on function member '__exit__'
Hi, the following file misses to produce W0613 (unused argument) for the three exc_* arguments of member function __exit__(): class MyContextManager(object): """dummy docstring""" def __enter__(self): pass def __exit__(self, exc_type, exc_val, exc_tb): return False def func1(self, exc_type, exc_val, exc_tb): """dummy docstring""" return False def __func2__(self, exc_type, exc_val, exc_tb): return False func1() and __func__2() which have just been added to see how pylint behaves for them, correctly produce W0613 for all three exc_* arguments. I am not aware of any pylint option that influences the specific behavior of pylint w.r.t. __exit__() and unused arguments. My pylint config file is the default generated one, except for a few changes for metrics related messages, and one change in naming conventions for modules. Versions: pylint 1.1.0, astroid 1.0.1, common 0.61.0 Python 2.6.8 (unknown, Sep 27 2013, 16:11:04) [GCC 4.3.4 [gcc-4_3-branch revision 152973]] When searching the issues database for 'W0613' and '__exit__' I did not find any existing bugs on this behavior. Please let me know whether this should be considered a bug and whether you want me to open an issue for it. Regards Andy
On 24 March 2014 17:06, Andreas Maier <andreas.r.maier@gmx.de> wrote:
Hi, the following file misses to produce W0613 (unused argument) for the three exc_* arguments of member function __exit__():
For me, this is a feature! Python force you to define the __exit__ method with those arguments and is not the user who defines method with extra / unused arguments. In many cased I don't use the exit arguments and they I would have to add fake references to those arguments to comply with pylint new warnings. -- Adi Roiban
participants (2)
-
Adi Roiban
-
Andreas Maier