KEMBAR78
`pathlib.PurePath.with_stem('')` promotes file extension to stem · Issue #114610 · python/cpython · GitHub
Skip to content

pathlib.PurePath.with_stem('') promotes file extension to stem #114610

@barneygale

Description

@barneygale

Bug report

>>> pathlib.PurePath('foo.jpg').with_stem('').stem
'.jpg'

The with_stem() call should raise ValueError, as it's impossible for a filename to have an empty stem and a non-empty suffix.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixestopic-pathlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions