Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python 3.10/3.8: shutil.rmtree(None, ignore_errors=True) behaves differently between Windows and *nix platforms #94692

Closed
Labels
docsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@RamseyK

Description

@RamseyK

Bug report

Expected behavior: Passing None to shutil.rmtree's path argument should not yield an exception when ignore_errors=True.

Behavior on MacOS Python 3.10 (MacPorts) - Correct behavior:

>>> import shutil>>> shutil.rmtree(None, ignore_errors=True)>>> shutil.rmtree(None)Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 712, in rmtree    onerror(os.lstat, path, sys.exc_info())  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 710, in rmtree    orig_st = os.lstat(path)TypeError: lstat: path should be string, bytes or os.PathLike, not NoneType

The above occurs on RedHat Linux 8 Python 3.8 and Python 3.10 as well.

Behavior on Windows (Incorrect/differs from MacOS/Linux):

>>> import shutil>>> shutil.rmtree(None, ignore_errors=True)Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "C:\Python310\lib\shutil.py", line 733, in rmtree    onerror(os.lstat, path, sys.exc_info())  File "C:\Python310\lib\shutil.py", line 577, in rmtree    orig_st = os.lstat(path)TypeError: lstat: path should be string, bytes or os.PathLike, not NoneType>>> shutil.rmtree(None)Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "C:\Python310\lib\shutil.py", line 733, in rmtree    onerror(os.lstat, path, sys.exc_info())  File "C:\Python310\lib\shutil.py", line 577, in rmtree    orig_st = os.lstat(path)TypeError: lstat: path should be string, bytes or os.PathLike, not NoneType

Environment

  • CPython Versions Tested: 3.8.x, 3.10.x
  • Operating Systems: Windows 10 21H2, MacOS, RedHat Linux 8 (x86-64)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp