Skip to content

Speed up pathlib.PurePath.[is_]relative_to() #111429

Closed

Description

@barneygale

Both methods call self.with_segments() unconditionally. This can be skipped if the other argument is already an instance of PurePath, and no further (deprecated) positional arguments are given.

Also, relative_to() can inline the core of the is_relative_to() check to avoid the type/deprecated args checks.

Linked PRs

Activity

  1. added a commit that references this issue on Oct 28, 2023
  2. added a commit that references this issue on Nov 12, 2023
  3. barneygale commented on Nov 12, 2023

    @barneygale
    ContributorAuthor

    Resolved in 3.13 / 6e93540 / #111431

  4. added a commit that references this issue on Feb 11, 2024
  5. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions