Skip to content

W0223 does not get raised correctly #9979

Open
@alibeyram

Description

@alibeyram

Bug description

The not implemented warning does not get raised

here is a simple code that shows it

from abc import ABC, abstractmethod


class Base(ABC):
    @abstractmethod
    def do_something(self):
        pass


class Derived(Base):
    def do_something_else(self):
        pass

One way to test it is to recreate abc.ABC and use that for inheriting

from abc import ABCMeta, abstractmethod


class MYABC(metaclass=ABCMeta):
   __slots__ = ()


class Base(MYABC):
   @abstractmethod
   def do_something(self):
       pass


class Derived(Base):  #### the W0223:abstract-method raised here
   def do_something_else(self):
       pass


### Configuration

_No response_

### Command used

```shell
pylint test.py

Pylint output

Your code has been rated at 10.00/10

Expected behavior

W0223: Method 'do_something' is abstract in class 'Base' but is not overridden in child class 'Derived' (abstract-method)

Pylint version

pylint 3.3.1
astroid 3.3.4
Python 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:32:50) [Clang 16.0.6 ]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions