Title: pathlib.PureWindowsPath.match() mishandles path anchors · Issue #101360 · python/cpython · GitHub
Open Graph Title: pathlib.PureWindowsPath.match() mishandles path anchors · Issue #101360 · python/cpython
X Title: pathlib.PureWindowsPath.match() mishandles path anchors · Issue #101360 · python/cpython
Description: pathlib.PurePath.match() doesn't use fnmatch() to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is specified in the pattern, it must exactly mat...
Open Graph Description: pathlib.PurePath.match() doesn't use fnmatch() to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is speci...
X Description: pathlib.PurePath.match() doesn't use fnmatch() to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is s...
Opengraph URL: https://github.com/python/cpython/issues/101360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pathlib.PureWindowsPath.match() mishandles path anchors","articleBody":"`pathlib.PurePath.match()` doesn't use `fnmatch()` to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is specified in the pattern, it must *exactly* match the corresponding drive/root in the path.\r\n\r\nThis results in the following:\r\n\r\n```python\r\n\u003e\u003e\u003e from pathlib import PureWindowsPath as P\r\n\u003e\u003e\u003e P('c:/b.py').match('*:/*.py')\r\nFalse\r\n\u003e\u003e\u003e P('c:/b.py').match('c:*.py')\r\nTrue\r\n\u003e\u003e\u003e P('c:/b.py').match('/*.py')\r\nTrue\r\n\u003e\u003e\u003e P('//some/share/a.py').match('//*/*/*.py')\r\nFalse\r\n\u003e\u003e\u003e P('//some/share/a.py').match('/*.py')\r\nTrue\r\n```\r\n\r\nAll of these results are wrong IMO.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-101363\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/barneygale","@type":"Person","name":"barneygale"},"datePublished":"2023-01-26T23:31:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/101360/cpython/issues/101360"}
| 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:5ce67aba-cbf4-cab9-e896-17e1242a8861 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C794:DBE5:FBF574:1506FAC:696991FE |
| html-safe-nonce | 50dce24ddc3077dec03e764d6af79fcab6c0e1a09903d714b1e7f34e863a41ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzk0OkRCRTU6RkJGNTc0OjE1MDZGQUM6Njk2OTkxRkUiLCJ2aXNpdG9yX2lkIjoiMjA3ODM5MDIxMDIzMDA2MzYxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f2c931694394da82b522145cc9fcb7ff73b71696343213287e858d369b6da2f4 |
| hovercard-subject-tag | issue:1558930144 |
| 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/101360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/329db79008e5067954d76f6282060db99dfb2347e52d8eba392f3c98d28319e2/python/cpython/issues/101360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/329db79008e5067954d76f6282060db99dfb2347e52d8eba392f3c98d28319e2/python/cpython/issues/101360 |
| og:image:alt | pathlib.PurePath.match() doesn't use fnmatch() to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is speci... |
| 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 | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| 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 | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width