This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Better exception message in os.path.join
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, tomasfarias
Priority: normal Keywords: patch

Created on 2019-11-15 01:02 by tomasfarias, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17160 merged tomasfarias, 2019-11-15 01:08
PR 17249 merged miss-islington, 2019-11-19 05:54
Messages (4)
msg356640 - (view) Author: Tomás Farías (tomasfarias) * Date: 2019-11-15 01:02
Passing an object with an invalid type, like None, to os.path.join after the first argument results in the following exception: 

TypeError: join() argument must be str or bytes, not 'NoneType'

Exception message can be updated to show that os.PathLike objects can be used:

TypeError: join() argument must be str, bytes or os.PathLike object, not 'NoneType'

This is also more consistent with the TypeError raised by os.fspath.
msg356945 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-11-19 05:54
New changeset fe75b62575bcfdf1c39be71c1e50257832a596db by Raymond Hettinger (Tomás Farías) in branch 'master':
bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (#17160)
https://github.com/python/cpython/commit/fe75b62575bcfdf1c39be71c1e50257832a596db
msg356946 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-11-19 05:54
Thanks for the report and for the PR.
msg356947 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-11-19 06:46
New changeset b5bb3b637c6b55f49d8979a5f489d01a67c4f917 by Raymond Hettinger (Miss Islington (bot)) in branch '3.8':
bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (GH-17160) (GH-17249)
https://github.com/python/cpython/commit/b5bb3b637c6b55f49d8979a5f489d01a67c4f917
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 82988
2019-11-19 06:46:19rhettingersetmessages: + msg356947
2019-11-19 05:54:55rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg356946

stage: patch review -> resolved
2019-11-19 05:54:31rhettingersetnosy: + rhettinger
messages: + msg356945
2019-11-19 05:54:16miss-islingtonsetpull_requests: + pull_request16746
2019-11-15 01:08:37tomasfariassetkeywords: + patch
stage: patch review
pull_requests: + pull_request16669
2019-11-15 01:02:30tomasfariascreate