python / typing_extensions

Backported and experimental type hints for Python
Other
446 stars 110 forks source link

Pylint raises error saying "default" isn't valid for TypeVar #411

Closed nfelt14 closed 6 months ago

nfelt14 commented 6 months ago

After upgrading to 4.12.0, pylint is raising the following error for TypeVars that have default values:

E1123: Unexpected keyword argument 'default' in constructor call (unexpected-keyword-arg)

The same code does not raise an error when using 4.11.0.

JelleZijlstra commented 6 months ago

Sounds like you found a bug in pylint. I don't know how pylint decides what keyword arguments a constructor call accepts, but typing_extensions.TypeVar definitely accepts default=.

Could you report this to pylint first? If there's some way we could write our code that makes pylint's job easier, I would consider it, but I have no idea what it's looking at.

nfelt14 commented 6 months ago

Sounds like you found a bug in pylint. I don't know how pylint decides what keyword arguments a constructor call accepts, but typing_extensions.TypeVar definitely accepts default=.

Could you report this to pylint first? If there's some way we could write our code that makes pylint's job easier, I would consider it, but I have no idea what it's looking at.

I will do that.