Skip to content

Headers.__delitem__ signature incompatible with ImmutableHeadersMixin.__delitem__ #1051

@ambv

Description

@ambv

Mypy recently introduced stricter checks for function signature compatibility (python/mypy#2521). Since werkzeug is included in the typeshed library with typing stubs, it found an issue with the signatures of __delitem__() in datastructure.py. Consider:

class Headers(Mapping):
  def __delitem__(self, key, _index_operation=True): ...

vs.

class ImmutableHeadersMixin(object):
  def __delitem__(self, key): ...

class EnvironHeaders(ImmutableHeadersMixin, Headers): ...

Basically, it's invalid to replace __delitem__() accepting an optional kwarg with an implementation that doesn't.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions