Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

os.path.relpath() needlessly callsabspath() when given two paths with matching anchors #99199

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@barneygale

Description

@barneygale

relpath() unconditionally callsabspath() to make both its arguments absolute before comparing them. This is necessary if the supplied arguments have different anchors, but it isnot necessary when the paths' anchors match. We can save a call togetcwd() /_getfinalpathname() by skipping theabspath() call in this case. This should improve performance a little.

For example, neither of the following should require a call toabspath() internally:

relpath('foo/bar','baz/ding')relpath('/etc/hosts','/usr/local/bin')

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp