Title: urllib.request.pathname2url() and url2pathname() remove slashes on Windows · Issue #126212 · python/cpython · GitHub
Open Graph Title: urllib.request.pathname2url() and url2pathname() remove slashes on Windows · Issue #126212 · python/cpython
X Title: urllib.request.pathname2url() and url2pathname() remove slashes on Windows · Issue #126212 · python/cpython
Description: Bug report Bug description: urllib.request.pathname2url() unexpectedly removes doubled and trailing slashes, but only on Windows, and only for DOS device paths (not UNC paths): >>> from urllib.request import pathname2url, url2pathname >>...
Open Graph Description: Bug report Bug description: urllib.request.pathname2url() unexpectedly removes doubled and trailing slashes, but only on Windows, and only for DOS device paths (not UNC paths): >>> from urllib.requ...
X Description: Bug report Bug description: urllib.request.pathname2url() unexpectedly removes doubled and trailing slashes, but only on Windows, and only for DOS device paths (not UNC paths): >>> from ur...
Opengraph URL: https://github.com/python/cpython/issues/126212
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"urllib.request.pathname2url() and url2pathname() remove slashes on Windows","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\n`urllib.request.pathname2url()` unexpectedly removes doubled and trailing slashes, but only on Windows, and only for DOS device paths (not UNC paths):\r\n\r\n```python\r\n>>> from urllib.request import pathname2url, url2pathname\r\n>>> pathname2url('C:\\\\')\r\n'///C:' # This is *not* the same path!\r\n>>> pathname2url('C:\\\\foo\\\\')\r\n'///C:/foo'\r\n>>> pathname2url('C:\\\\foo\\\\\\\\bar')\r\n'///C:/foo/bar'\r\n```\r\n\r\n`url2pathname()` does almost the same thing, except that it specially preserves a slash immediately after a DOS drive (but not elsewhere):\r\n\r\n```python\r\n>>> url2pathname('///c:/')\r\n'C:\\\\' # OK\r\n>>> url2pathname('///c:/foo/')\r\n'C:\\\\foo'\r\n>>> url2pathname('///c:/foo//bar')\r\n'C:\\\\foo\\\\bar'\r\n```\r\n\r\nThis behaviour makes no sense and has no equivalent on POSIX, where all slashes are preserved.\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nWindows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-126214\n* gh-126590\n* gh-126591\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2024-10-30T23:52:07Z","url":"https://github.com/python/cpython/issues/126212"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:c4400178-1249-8dd4-c299-d6944cc46b10 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E22E:3A73AA:3B4EEEC:4B1496B:6B023AA4 |
| html-safe-nonce | 2d308550d44a018c21d422f1360ea3d841b7fab2386cbc0a71a08d9fa9f40171 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjJFOjNBNzNBQTozQjRFRUVDOjRCMTQ5NkI6NkIwMjNBQTQiLCJ2aXNpdG9yX2lkIjoiMzY5MTY4MTQyOTU5NjU1MTg0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 53bc145acb5b3fa1a5efffcecb58cf2e68d5598aeedde0a0490a524629c38055 |
| hovercard-subject-tag | issue:2625616097 |
| 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/126212/issue_layout |
| twitter:image | https://opengraph.githubassets.com/57500e1f368ca20ee6c352fe02cafbd003c562b2817479de66eeaae7a6d9e9d5/python/cpython/issues/126212 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/57500e1f368ca20ee6c352fe02cafbd003c562b2817479de66eeaae7a6d9e9d5/python/cpython/issues/126212 |
| og:image:alt | Bug report Bug description: urllib.request.pathname2url() unexpectedly removes doubled and trailing slashes, but only on Windows, and only for DOS device paths (not UNC paths): >>> from urllib.requ... |
| 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 | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width