Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python 3.9] Mypy complains str has no attribute removesuffix #9548

Closed
fniessink opened this issue Oct 7, 2020 · 4 comments
Closed

[Python 3.9] Mypy complains str has no attribute removesuffix #9548

fniessink opened this issue Oct 7, 2020 · 4 comments
Labels
bug mypy got something wrong

Comments

@fniessink
Copy link

Bug Report

Mypy complains str has no attribute removesuffix with Python 3.9.

To Reproduce

python3.9 -m venv venv
. venv/bin/activate
pip install mypy
echo '"123".removesuffix("3")' > test.py
mypy test.py

Expected Output

Success: no issues found in 1 source file

Actual Output

test.py:1: error: "str" has no attribute "removesuffix"
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 0.782
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.9.0
  • Operating system and version: macOS Catalina, version 10.15.7
@fniessink fniessink added the bug mypy got something wrong label Oct 7, 2020
@hauntsaninja
Copy link
Collaborator

I added this in typeshed a couple months ago / is fixed on master

@hauntsaninja
Copy link
Collaborator

Thank you for the report, though! :-)

@fniessink
Copy link
Author

No problem. However, I'm not sure what's next. I checked the mypy documentation and FAQ but it isn't clear to me what I'm supposed to do to get mypy correctly checking Python 3.9 code?

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Oct 7, 2020

You can install mypy from Github master or wait for the next release (#9290). Or you can continue to use mypy 0.782, download a copy of the latest typeshed and use mypy --custom-typeshed-dir <location of downloaded typeshed>.

(Based on your report this doesn't apply, but if the Python you're using to run mypy is older, you'll need to pass in --python-version 3.9, as per https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-python-version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants