Skip to content

gh-78722: Fixed, pathlib.Path.iterdir now throws an exception when path is not valid #8999

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

Closed
wants to merge 2 commits into from

Conversation

prudvinit
Copy link

@prudvinit prudvinit commented Aug 29, 2018

@prudvinit
Copy link
Author

prudvinit commented Aug 29, 2018 via email

@remilapeyre
Copy link
Contributor

Hi @prudvinit, thanks for opening a PR. I'm not sure that your fix is correct but "test coverage" means writing a test to show code that was broken by the previous behavior of the function you changed so iterdir() in your case, and that your changed fixed. This serves multiple purposes, it shows the bug, shows your solution work and the test will fail if someone make another change that ends up breaking your fix.

The tests for the pathlib module are in test_pathlib.py, you can look at the other tests of iterdir() to try and write your own. I would be happy to help you if you get stuck.

@prudvinit
Copy link
Author

prudvinit commented May 24, 2019 via email

@iritkatriel
Copy link
Member

@prudvinit are you still working on this? Otherwise, could we close the PR so that someone else may pick it up?

@prudvinit
Copy link
Author

prudvinit commented May 26, 2021 via email

@barneygale
Copy link
Contributor

Hey @prudvinit - do you think you might have time to resolve conflicts and add tests? This looks like a useful fix!

@AlexWaygood AlexWaygood changed the title bpo-34541: Fixed, pathlib.Path.iterdir now throws an exception when path is not valid gh-78722: Fixed, pathlib.Path.iterdir now throws an exception when path is not valid Jan 8, 2023
@barneygale
Copy link
Contributor

Thanks for this PR @prudvinit! In the discussion on the issue, we reached the conclusion that changing behaviour would be too disruptive, and that list(path.iterdir()) is a reasonable workaround. As such I'm closing both the issue and this PR.

@barneygale barneygale closed this Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants