Title: `os.path.relpath()` needlessly calls `abspath()` when given two paths with matching anchors · Issue #99199 · python/cpython · GitHub
Open Graph Title: `os.path.relpath()` needlessly calls `abspath()` when given two paths with matching anchors · Issue #99199 · python/cpython
X Title: `os.path.relpath()` needlessly calls `abspath()` when given two paths with matching anchors · Issue #99199 · python/cpython
Description: relpath() unconditionally calls abspath() to make both its arguments absolute before comparing them. This is necessary if the supplied arguments have different anchors, but it is not necessary when the paths' anchors match. We can save a...
Open Graph Description: relpath() unconditionally calls abspath() to make both its arguments absolute before comparing them. This is necessary if the supplied arguments have different anchors, but it is not necessary when...
X Description: relpath() unconditionally calls abspath() to make both its arguments absolute before comparing them. This is necessary if the supplied arguments have different anchors, but it is not necessary when...
Opengraph URL: https://github.com/python/cpython/issues/99199
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`os.path.relpath()` needlessly calls `abspath()` when given two paths with matching anchors","articleBody":"`relpath()` unconditionally calls `abspath()` to make both its arguments absolute before comparing them. This is necessary if the supplied arguments have different anchors, but it is *not* necessary when the paths' anchors match. We can save a call to `getcwd()` / `_getfinalpathname()` by skipping the `abspath()` call in this case. This should improve performance a little.\r\n\r\nFor example, neither of the following should require a call to `abspath()` internally:\r\n\r\n```python\r\nrelpath('foo/bar', 'baz/ding')\r\nrelpath('/etc/hosts', '/usr/local/bin')\r\n```","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2022-11-07T12:26:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/99199/cpython/issues/99199"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4040410b-874d-8012-f7bc-385911fbe1f5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8EFE:511EE:705FFC:97A2D0:696976A3 |
| html-safe-nonce | de68810529aa89a116fbfae0c84f4121a17af39add6246a02a850f3632babaf9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RUZFOjUxMUVFOjcwNUZGQzo5N0EyRDA6Njk2OTc2QTMiLCJ2aXNpdG9yX2lkIjoiNTg4NjUwODgyNDE5NjExODE3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dce0086080c2697b2f46b5d98bd4fa71d9aecbf014b9808317132cad538a730b |
| hovercard-subject-tag | issue:1438279318 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/99199/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6d0f817fe5a8396bbdb94988a3207ed23992dfcb940048f2b3bd1909c31494b/python/cpython/issues/99199 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6d0f817fe5a8396bbdb94988a3207ed23992dfcb940048f2b3bd1909c31494b/python/cpython/issues/99199 |
| og:image:alt | relpath() unconditionally calls abspath() to make both its arguments absolute before comparing them. This is necessary if the supplied arguments have different anchors, but it is not necessary when... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | barneygale |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6f193beb8ff08443adc07685d75302ab8aaf0a135f6e251c3ff3112c8deb881 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 212e3e3d3298bf5b313830edfd2399e869f7ea76 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width