Skip to content

Improve performance of pathlib.Path.absolute() #100562

Closed
@barneygale

Description

@barneygale

The current implementation of pathlib.Path.absolute() calls self.cwd() rather than os.getcwd(), and so constructs two Path objects rather than one. As path objects are slow to construct, this has a performance impact.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesperformancePerformance or resource usagetopic-pathlibtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions