Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better exception message in os.path.join #82988

Closed
tomasfarias mannequin opened this issue Nov 15, 2019 · 4 comments
Closed

Better exception message in os.path.join #82988

tomasfarias mannequin opened this issue Nov 15, 2019 · 4 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@tomasfarias
Copy link
Mannequin

tomasfarias mannequin commented Nov 15, 2019

BPO 38807
Nosy @rhettinger, @tomasfarias
PRs
  • bpo-38807: Add os.PathLike to exception message raised by _check_arg_types #17160
  • [3.8] bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (GH-17160) #17249
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-11-19.05:54:55.704>
    created_at = <Date 2019-11-15.01:02:29.978>
    labels = ['type-feature', 'library', '3.9']
    title = 'Better exception message in os.path.join'
    updated_at = <Date 2019-11-19.06:46:19.247>
    user = 'https://github.com/tomasfarias'

    bugs.python.org fields:

    activity = <Date 2019-11-19.06:46:19.247>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-11-19.05:54:55.704>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2019-11-15.01:02:29.978>
    creator = 'tomasfarias'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38807
    keywords = ['patch']
    message_count = 4.0
    messages = ['356640', '356945', '356946', '356947']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'tomasfarias']
    pr_nums = ['17160', '17249']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue38807'
    versions = ['Python 3.9']

    @tomasfarias
    Copy link
    Mannequin Author

    tomasfarias mannequin commented Nov 15, 2019

    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.

    @tomasfarias tomasfarias mannequin added 3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 15, 2019
    @rhettinger
    Copy link
    Contributor

    New changeset fe75b62 by Raymond Hettinger (Tomás Farías) in branch 'master':
    bpo-38807: Add os.PathLike to exception message raised by _check_arg_types (bpo-17160)
    fe75b62

    @rhettinger
    Copy link
    Contributor

    Thanks for the report and for the PR.

    @rhettinger
    Copy link
    Contributor

    New changeset b5bb3b6 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)
    b5bb3b6

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant