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

Path.with_suffix() raises TypeError when doing %-formatting #78514

Closed
berkerpeksag opened this issue Aug 3, 2018 · 3 comments
Closed

Path.with_suffix() raises TypeError when doing %-formatting #78514

berkerpeksag opened this issue Aug 3, 2018 · 3 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@berkerpeksag
Copy link
Member

BPO 34333
Nosy @pitrou, @berkerpeksag
PRs
  • bpo-34333: Fix %-formatting in Path.with_suffix() #8663
  • [3.7] bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663) #8731
  • 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 = 'https://github.com/berkerpeksag'
    closed_at = <Date 2018-08-11.06:00:36.323>
    created_at = <Date 2018-08-03.21:03:06.973>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'Path.with_suffix() raises TypeError when doing %-formatting'
    updated_at = <Date 2018-08-11.06:00:36.322>
    user = 'https://github.com/berkerpeksag'

    bugs.python.org fields:

    activity = <Date 2018-08-11.06:00:36.322>
    actor = 'berker.peksag'
    assignee = 'berker.peksag'
    closed = True
    closed_date = <Date 2018-08-11.06:00:36.323>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2018-08-03.21:03:06.973>
    creator = 'berker.peksag'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34333
    keywords = ['patch']
    message_count = 3.0
    messages = ['323078', '323398', '323399']
    nosy_count = 2.0
    nosy_names = ['pitrou', 'berker.peksag']
    pr_nums = ['8663', '8731']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34333'
    versions = ['Python 3.7', 'Python 3.8']

    @berkerpeksag
    Copy link
    Member Author

    import pathlib
    
    path = pathlib.Path('TR')
    with_suffix = path.with_suffix(('/', '.md'))

    The snippet I shared above will raise:

    TypeError: not all arguments converted during string formatting
    

    While we are relying on duck typing, I think this can be considered as a bug in this case.

    @berkerpeksag berkerpeksag added 3.7 (EOL) end of life 3.8 only security fixes labels Aug 3, 2018
    @berkerpeksag berkerpeksag self-assigned this Aug 3, 2018
    @berkerpeksag berkerpeksag added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 3, 2018
    @berkerpeksag
    Copy link
    Member Author

    New changeset 423d05f by Berker Peksag in branch 'master':
    bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)
    423d05f

    @berkerpeksag
    Copy link
    Member Author

    New changeset c614121 by Berker Peksag (Miss Islington (bot)) in branch '3.7':
    bpo-34333: Fix %-formatting in Path.with_suffix() (GH-8663)
    c614121

    @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 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant