Skip to content

PurePosixPath subclass causing Mismatch between signature.. since 1.1.373 #8525

Answered by erictraut
davetapley asked this question in Q&A
Discussion options

You must be logged in to vote

I presume that you have manually enabled the reportInconsistentConstructor check or enabled "strict" type checking mode in your configuration. This diagnostic check is not enabled by default. If you don't want errors of this type to be reported, you can turn it back off.

The purpose of this check is to report situations where the __new__ method and __init__ method for a class are inconsistent. That is the case in your example.

According to the typeshed stubs, the class PurePosixPath inherits a __new__ method from PurePath, and it is defined as:

    if sys.version_info >= (3, 12):
        def __new__(cls, *args: StrPath, **kwargs: Unused) -> Self: ...
    else:
        def __new__(cls, *args

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by davetapley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants