GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pathlib.Path.with_suffix(None) became allowed in Python 3.13b1 · Issue #119113 · python/cpython

pathlib.Path.with_suffix(None) became allowed in Python 3.13b1 #119113

New issue
Copy link
New issue
Copy link
Closed
Closed
pathlib.Path.with_suffix(None) became allowed in Python 3.13b1#119113
Copy link
Labels
3.13only security fixesonly security fixestopic-pathlibtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@bluetech
bluetech
opened on May 17, 2024
Issue body actions

Bug report

Bug description:

In Python 3.13b1 (compared to Python 3.12 and earlier), the behavior of pathlib.Path.with_suffix(None) changed from raising an incidental TypeError to removing the suffix. This casues a certain test in pytest to fail. I am going to fix pytest to not rely on this in any case, but I think pathlib should either:

  • Restore the previous behavior if it was unintended, or
  • Update the doc that None is now accepted. Currently it says " If the suffix is an empty string, the original suffix is removed".

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux

Linked PRs

  • GH-119113: Raise TypeError from pathlib.PurePath.with_suffix(None) #119124
  • [3.13] GH-119113: Raise TypeError from pathlib.PurePath.with_suffix(None) (GH-119124) #119183
Reacted by Barney Gale

Activity

  1. bluetech
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 17, 2024
  2. aisk
    added
    topic-pathlib
    3.13only security fixesonly security fixes
    on May 17, 2024
  3. nineteendo commented on May 17, 2024

    @nineteendo
    nineteendo
    on May 17, 2024
    Contributor
    More actions

    Bisected to 19a1fc1

    cpython/Lib/pathlib/_abc.py

    Line 208 in 100c7ab

    if not suffix:

    I guess we could replace that with this:

    if suffix == '':

    But we usually don't go out of our way to raise type errors.

    Reacted by Barney Gale
  4. barneygale
    added 2 commits that reference this issue on May 17, 2024

    pythonGH-119113: Raise `TypeError` on `pathlib.PurePath.with_suffix(N…

    ad0cf26

    GH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffix(None)` (

    3c28510
  5. miss-islington
    added a commit that references this issue on May 19, 2024

    pythonGH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffix…

    5d80e48
  6. barneygale
    added a commit that references this issue on May 19, 2024

    [3.13] GH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffi…

    27b61c1
  7. barneygale commented on May 19, 2024

    @barneygale
    barneygale
    on May 19, 2024
    Contributor
    More actions

    Thanks for reporting! Should be fixed in 3.13 beta 2.

  8. barneygale
    closed this as completedon May 19, 2024
  9. estyxx
    added a commit that references this issue on Jul 17, 2024

    pythonGH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffix…

    ed048f2
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.13only security fixesonly security fixestopic-pathlibtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.