Skip to content

Handle ValueError in filecmp.dircmp and filecmp.cmpfiles #122400

Closed
@picnixz

Description

@picnixz

Bug report

Bug description:

In filecmp.cmpfiles, when the path is not stat-able, it will be put in the "fancy" files. This should include paths that would raise ValueError.

Note that filecmp.cmp should not be protected against that since it already ignores an OSError possibly raised by os.stat.

Similarly, filecmp.dircmp should not suppress OSError or ValueError when listing the directory contents. It should however silence ValueError when checking the common files since it already silence an OSError.

TL;DR: Only protect against ValueError if the current code is already protecting against OSError.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions