Skip to content

Error handling and documentation of Path.home() #85254

Closed

Description

@timhoffm
mannequin
BPO 41082
Nosy @ambv, @timhoffm, @akulakov
PRs
  • [3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() #28186
  • 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 2021-09-08.17:28:49.896>
    created_at = <Date 2020-06-22.21:13:41.917>
    labels = ['type-bug', 'library', '3.9']
    title = 'Error handling and documentation of Path.home()'
    updated_at = <Date 2021-09-08.17:28:49.896>
    user = 'https://github.com/timhoffm'

    bugs.python.org fields:

    activity = <Date 2021-09-08.17:28:49.896>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-08.17:28:49.896>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2020-06-22.21:13:41.917>
    creator = 'timhoffm'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41082
    keywords = ['patch']
    message_count = 6.0
    messages = ['372116', '399598', '401166', '401404', '401412', '401414']
    nosy_count = 3.0
    nosy_names = ['lukasz.langa', 'timhoffm', 'andrei.avk']
    pr_nums = ['28186']
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue41082'
    versions = ['Python 3.9']

    Activity

    1. timhoffm commented on Jun 22, 2020

      timhoffmmannequin
      MannequinAuthor

      Path.home() may fail un
      (matplotlib/matplotlib#17707 (comment)).

      1. I think the raised key error is too low-level, and it should be something else; what exactly t.b.d.
      2. The documentation (https://docs.python.org/3/library/pathlib.html#pathlib.Path.home) should specify what happens in case of failure.
      3. The documentation links to https://docs.python.org/3/library/os.path.html#os.path.expanduser, but that's not correct. _PosixFlavor.gethomedir() implements it's own user lookup, which is slightly different from os.path.expanduser()
    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jun 22, 2020
    3. akulakov commented on Aug 14, 2021

      @akulakov
      Contributor

      In current dev version (3.11), _PosixFlavor doesn't have gethomedir(), and instead os.path.expanduser() is used via _NormalAccessor(). So at least for the current dev version, the docs are accurate.

    4. akulakov commented on Sep 6, 2021

      @akulakov
      Contributor

      I looked a bit more into this, it's been fixed in 3.10, in this PR: #18841

      It wasn't backported to 3.9. I'm not quite sure if it's best to backport to 3.9 or fix via docs for 3.9. Just in case I've put up a small PR for such a docfix.

    5. ambv commented on Sep 8, 2021

      @ambv
      Contributor

      Using os.path.expanduser is a functional change so it wasn't backported at the time to 3.9 and sure shouldn't be backported now. Going with a doc update is the right approach.

    6. ambv commented on Sep 8, 2021

      @ambv
      Contributor

      New changeset dc2e11e by andrei kulakov in branch '3.9':
      [3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() (GH-28186)
      dc2e11e

    7. ambv commented on Sep 8, 2021

      @ambv
      Contributor

      Behavior is fixed in Python 3.10+. For Python 3.9 the docs are updated to list possible exceptions. Since this was reported with 3.9 in mind, I'm marking this one as wontfix.

      Thanks for picking this up, Andrei! ✨ 🍰 ✨

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.9 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions