Skip to content

unexpected behavior of pathlib with empty string #140971

@sarnold

Description

@sarnold

Bug report

Bug description:

While os.path.exists("") correctly returns False, the same input with Path("").exists() returns True.

>>> from pathlib import Path
>>> import os
>>> Path("").exists()
True
>>> os.path.exists("")
False
>>>

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirtopic-pathlibtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions