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

pathlib Path.match does not behave as described #79669

Closed
tonybaloney mannequin opened this issue Dec 14, 2018 · 5 comments
Closed

pathlib Path.match does not behave as described #79669

tonybaloney mannequin opened this issue Dec 14, 2018 · 5 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir

Comments

@tonybaloney
Copy link
Mannequin

tonybaloney mannequin commented Dec 14, 2018

BPO 35488
Nosy @brettcannon, @tonybaloney, @tirkarthi
PRs
  • bpo-35488: Add test for ** glob matching in pathlib #11171
  • Files
  • test_pathlib.py
  • 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-04-08.07:52:28.623>
    created_at = <Date 2018-12-14.06:40:23.947>
    labels = ['3.7', 'library']
    title = 'pathlib Path.match does not behave as described'
    updated_at = <Date 2019-04-08.07:52:28.622>
    user = 'https://github.com/tonybaloney'

    bugs.python.org fields:

    activity = <Date 2019-04-08.07:52:28.622>
    actor = 'anthony shaw'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-04-08.07:52:28.623>
    closer = 'anthony shaw'
    components = ['Library (Lib)']
    creation = <Date 2018-12-14.06:40:23.947>
    creator = 'anthony shaw'
    dependencies = []
    files = ['47996']
    hgrepos = []
    issue_num = 35488
    keywords = ['patch']
    message_count = 5.0
    messages = ['331782', '331791', '331878', '331890', '333117']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'anthony shaw', 'xtreak']
    pr_nums = ['11171']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue35488'
    versions = ['Python 3.7']

    @tonybaloney
    Copy link
    Mannequin Author

    tonybaloney mannequin commented Dec 14, 2018

    The documentation for pathlib PurePath.match(needle) says it accepts "glob-style pattern.".

    For an absolute path with a recursive pattern (**) it doesn't match correct for more than 1 directory level.

    All of the assertions in the attached file should pass.

    The issue I've seen is on the attached file. I'm using Python 3.7.1 and have also tested this against Python 3.6.6 with the pathlib module on PyPi.

    Absolute path glob'ing with a recursive pattern works as expected:

    entries = pathlib.Path('/var').glob('/var/**/*.log')

    Once this issue is confirmed, I would be happy to test & contribute a fix

    @tonybaloney tonybaloney mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Dec 14, 2018
    @tirkarthi
    Copy link
    Member

    Is this similar to bpo-29249 (See also msg285311) and bpo-34731 ? As I can see in Lib/test/test_pathlib.py there are also no tests for "**" and I think it's good to add one along with documenting it.

    @tonybaloney
    Copy link
    Mannequin Author

    tonybaloney mannequin commented Dec 14, 2018

    Raised a PR for the test. Will look into doc PR

    @tonybaloney
    Copy link
    Mannequin Author

    tonybaloney mannequin commented Dec 15, 2018

    Yes, this is similar to https://bugs.python.org/issue29249
    In that issue, it suggests this feature is not supported, but that is neither documented, nor tested.

    @brettcannon
    Copy link
    Member

    New changeset 83da926 by Brett Cannon (Anthony Shaw) in branch 'master':
    bpo-35488: Add tests for ** glob matching in pathlib (GH-11171)
    83da926

    @tonybaloney tonybaloney mannequin closed this as completed Apr 8, 2019
    @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.7 (EOL) end of life stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants