Skip to content

False positive for shutil.rmtree for python 3.12 #12103

Closed
@wch

Description

@wch

Consider the following file:

import shutil

shutil.rmtree("abcd")

If I run pyright 1.1.366 on it, it reports an error:

❯ pyright --version
pyright 1.1.366
❯ pyright test.py --pythonversion 3.12
/Users/winston/temp/test.py
  /Users/winston/temp/test.py:3:8 - error: The function "rmtree" is deprecated
    The `onerror` parameter is deprecated and will be removed in Python 3.14. Use `onexc` instead. (reportDeprecated)
1 error, 0 warnings, 0 informations 

However, I was not able to reproduce the issue using mypy (the custom typeshed dir was a git clone of this repository at main, b3fc7e2):

❯ mypy --python-version 3.12 --custom-typeshed-dir typeshed test.py
Success: no issues found in 1 source file

I originally filed this issue on the pyright repository (microsoft/pyright#8087), but was told that pyright is working correctly. If that's the case, that would mean it's an issue with shutil.pyi type stub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: regressionSomething that worked before doesn't work anymorestubs: false positiveType checkers report false errors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions