Skip to content

Conversation

@nineteendo
Copy link
Contributor

@nineteendo nineteendo commented Apr 6, 2024

@nineteendo nineteendo marked this pull request as ready for review April 6, 2024 16:43
@aisk
Copy link
Contributor

aisk commented Apr 6, 2024

If the ValueError is raised by if not path: check, the falsy values 0 and [] will also raise the same ValueError, which is also strange. Maybe we can change the check to if path == "".

@nineteendo
Copy link
Contributor Author

No we can not, that doesn't work for Pathlike objects nor bytes.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit 733e56e into python:main Apr 7, 2024
@nineteendo nineteendo deleted the fix-posixpath.relpath branch April 7, 2024 11:16
@nineteendo
Copy link
Contributor Author

@serhiy-storchaka can we back port this to 3.12? It's a pure bug fix.

@bedevere-app
Copy link

bedevere-app bot commented May 22, 2024

GH-119388 is a backport of this pull request to the 3.12 branch.

@serhiy-storchaka
Copy link
Member

I do not think this is a bug fix. Normally you should not pass None to relpath(), so this does not affect most of applications. If for some reasons you passed an argument of wrong type without checking it, and handle the resulting ValueError, changing the exception type to TypeError is a breaking change. Even if it is right in the long run, it should not be done is the bugfix release.

@nineteendo
Copy link
Contributor Author

Thanks, closed the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants