Skip to content

false alarm on decode call #16441

Description

@florianschanda

Bug Report

The following file is legal python, as far as I understand it:

import codecs

a = codecs.lookup("UTF-8")
b = bytes(b"potato")
c = a.decode(b, errors="replace")

Running mypy 2.3.1 produces:

$ mypy wibble.py
wibble.py:5: error: Unexpected keyword argument "errors" for "__call__" of "_Decoder"  [call-arg]
wibble.py:5: note: "__call__" defined in "codecs"

To Reproduce

https://mypy-play.net/?mypy=latest&python=latest&gist=e34d60fa6ddb3835c9d2dae7eae7a301

Expected Behavior

I would expect no message at all. Reasoning:

Actual Behavior

False alarm is issued.

Your Environment

  • Mypy version used: 2.3.1
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 2.13.5 (from Debian trixie)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false positiveType checkers report false errors

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions