Skip to content

os.path.exists.__name__ is different on Windows since #101196 #115012

Closed as not planned
@digitalresistor

Description

@digitalresistor

Bug report

Bug description:

On macOS/Linux and Windows (before Python 3.12):

>>> import os
>>> os.path.exists.__name__
'exists'

Since Python 3.12 on Windows:

>>> import os
>>> os.path.exists.__name__
'_path_exists'

This was introduced in #101196 where optimized calls were made available on Windows.

Now, I will be honest that relying on the __name__ for os.path.exists is not great, but unfortunately I found this when running a test suite where we were relying on the __name__ being exists, which has been the case since at least Python 2.6 when I first took over maintenance of the project.

CPython versions tested on:

3.8, 3.9, 3.10, 3.11, 3.12

Operating systems tested on:

Linux, macOS, Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixesOS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions