Skip to content

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

Closed

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    3.11only security fixes
    3.12only security fixes
    3.13only security fixes
    on Jan 26, 2024
  2. added 6 commits that reference this issue on Jan 26, 2024
  3. added a commit that references this issue on Feb 11, 2024
  4. added a commit that references this issue on Feb 24, 2024
  5. added a commit that references this issue on Mar 4, 2024
  6. added a commit that references this issue on Apr 17, 2024
  7. added a commit that references this issue on Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13only 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