Skip to content

bpo-42053: fixed fwalk incorrect boolean test for non-fd arguments #27524

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 5 commits into from
Closed

Conversation

AliyevH
Copy link
Contributor

@AliyevH AliyevH commented Aug 1, 2021

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.

Please add a test (calling fwalk() with an object implementing __index__).

The NEWS entry is also required.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@serhiy-storchaka serhiy-storchaka added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Aug 1, 2021
@AliyevH
Copy link
Contributor Author

AliyevH commented Aug 4, 2021

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@serhiy-storchaka: please review the changes made to this pull request.

@akulakov
Copy link
Contributor

akulakov commented Aug 4, 2021

It looks like we don't have a test for fwalk(top=fd) where fd would be a valid fd obj that fwalk() can successfully use. It might be nice to add a test for that because the current test would logically build on top of that, as a non-int obj implementing __index__ is meant to be usable as an fd, as implied by current code (and I assume that would actually work).

@AliyevH
Copy link
Contributor Author

AliyevH commented Aug 8, 2021

@akulakov thanks for review.
You suggest to rewrite logic of test? sorry didn't understand. Can you please provide more information?

@serhiy-storchaka. Can you please review too?

@akulakov
Copy link
Contributor

akulakov commented Aug 8, 2021

@AliyevH fwalk doesn't seem to be working for valid fd in my testing:

[ins] In [69]: fw=os.fwalk(fd, follow_symlinks=True)

[ins] In [70]: list(fw)

TypeError: open: path should be string, bytes or os.PathLike, not int

@serhiy-storchaka
Copy link
Member

I confirm that fwalk() does not support integer first argument, and never supported (this is why there are no tests). The check is misleading and should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting change review needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants