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

Fix TypedDict inherit-non-class false-positive Python 3.9+ #4072

Merged
merged 1 commit into from
Feb 15, 2021
Merged

Fix TypedDict inherit-non-class false-positive Python 3.9+ #4072

merged 1 commit into from
Feb 15, 2021

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Feb 4, 2021

Steps

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

In Python 3.9 typing.TypedDict changed from a class to function with some metaclass magic.
This caused a inherit-non-class error for valid code.

Source code
Python 3.8 - typing.py
Python 3.9 - typing.py

Documentation
https://docs.python.org/3/library/typing.html#typing.TypedDict

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
📜 Docs

Related Issue

Closes #1927

@Pierre-Sassoulas
Copy link
Member

The fix seems clean enough even if it's not generic aka "make astroid understand the metaclass magic". Will merge when the master branch is fixed.

@coveralls
Copy link

coveralls commented Feb 15, 2021

Coverage Status

Coverage increased (+0.001%) to 90.581% when pulling 5ca0b43 on cdce8p:fix-typedDict into 1282688 on PyCQA:master.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 02d8659 into pylint-dev:master Feb 15, 2021
@cdce8p cdce8p deleted the fix-typedDict branch February 15, 2021 16:08
@cdce8p
Copy link
Member Author

cdce8p commented Feb 28, 2021

I just opened a MR in astroid to fix it there: pylint-dev/astroid#915
Once that is merged, this one could be reverted.

@Pierre-Sassoulas
Copy link
Member

Well, except the tests and the changelog, I like those ;)

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

Successfully merging this pull request may close these issues.

mypy_extensions.TypedDict errors because when creating a class, it is inferred as an instance
3 participants