[code-quality] Possible bug: False negative for W0613 on function member '__exit__'

Andreas Maier andreas.r.maier at gmx.de
Mon Mar 24 16:06:31 CET 2014


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



More information about the code-quality mailing list