Title: pathlib.PureWindowsPath comparison results vary between Windows and Posix · Issue #104947 · python/cpython · GitHub
Open Graph Title: pathlib.PureWindowsPath comparison results vary between Windows and Posix · Issue #104947 · python/cpython
X Title: pathlib.PureWindowsPath comparison results vary between Windows and Posix · Issue #104947 · python/cpython
Description: In #31691 I switched pathlib.PureWindowsPath comparisons to use os.path.normcase() rather than str.lower(). This is probably a mistake, as @eryksun points out: The inconsistency is with ntpath.normcase() on Windows. It's probably for the...
Open Graph Description: In #31691 I switched pathlib.PureWindowsPath comparisons to use os.path.normcase() rather than str.lower(). This is probably a mistake, as @eryksun points out: The inconsistency is with ntpath.norm...
X Description: In #31691 I switched pathlib.PureWindowsPath comparisons to use os.path.normcase() rather than str.lower(). This is probably a mistake, as @eryksun points out: The inconsistency is with ntpath.norm...
Opengraph URL: https://github.com/python/cpython/issues/104947
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pathlib.PureWindowsPath comparison results vary between Windows and Posix","articleBody":"In #31691 I switched `pathlib.PureWindowsPath` comparisons to use `os.path.normcase()` rather than `str.lower()`. This is probably a mistake, as @eryksun [points out](https://github.com/python/cpython/issues/104484#issuecomment-1560419031):\r\n\r\n\u003e The inconsistency is with `ntpath.normcase()` on Windows. It's probably for the best if the pure comparison methods revert to using `str.lower()` for the sake of consistency, not only with `glob()` and `match()`, but also with using `PureWindowsPath` on POSIX. Maybe platform-dependent comparisons could be implemented on `Path`.\r\n\u003e \r\n\u003e On Windows, `ntpath.normcase()` is based on `LCMapStringEx()`. It turns out that this function implements a case mapping for some non-BMP characters. WinAPI [`CompareStringOrdinal()`](https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringordinal), on the other hand, has no case mapping for non-BMP characters, which is consistent with Microsoft's filesystems. Thus I'd prefer for a platform-dependent comparison to use `CompareStringOrdinal()` instead of `LCMapStringEx()`.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104948\n* gh-104990\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2023-05-25T21:46:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/104947/cpython/issues/104947"}
| 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:cca185b8-cbb2-a0c5-a3a6-a68e4d460d77 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 807E:21F30D:18435:20B2A:69695083 |
| html-safe-nonce | 8fb145c3e7f86d66c1c7eda59cc55030ce48b26b353cd06cbe542036751425d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDdFOjIxRjMwRDoxODQzNToyMEIyQTo2OTY5NTA4MyIsInZpc2l0b3JfaWQiOiIyOTIxMjAwODQyNTQ0MDc0ODgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 680de8e53067a9c06447cc61e079abade8558eea46a6c2f62a9761d69b50be2c |
| hovercard-subject-tag | issue:1726527756 |
| 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/104947/issue_layout |
| twitter:image | https://opengraph.githubassets.com/33503fac5e5f95ddce4f5b215f0f570543edc5069665ef5a9231f384be902657/python/cpython/issues/104947 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/33503fac5e5f95ddce4f5b215f0f570543edc5069665ef5a9231f384be902657/python/cpython/issues/104947 |
| og:image:alt | In #31691 I switched pathlib.PureWindowsPath comparisons to use os.path.normcase() rather than str.lower(). This is probably a mistake, as @eryksun points out: The inconsistency is with ntpath.norm... |
| 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 | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| 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 | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width