pathlib.Path.with_suffix(None) became allowed in Python 3.13b1 #119113
Copy link
Copy link
Closed
Labels
3.13only security fixesonly security fixestopic-pathlibtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on May 17, 2024 - added a commit that references this issue
on May 19, 2024 Thanks for reporting! Should be fixed in 3.13 beta 2.
Metadata
Metadata
Assignees
Labels
3.13only security fixesonly security fixestopic-pathlibtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
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 incidentalTypeErrorto 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:Noneis 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
TypeErrorfrompathlib.PurePath.with_suffix(None)#119124TypeErrorfrompathlib.PurePath.with_suffix(None)(GH-119124) #119183