Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Convert os.readlink() to Argument Clinic. #8778

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

Merged
merged 2 commits into from
Sep 17, 2018

Conversation

serhiy-storchaka
Copy link
Member

Also convert os.get_blocking() and os.set_blocking().

Also convert os.get_blocking() and os.set_blocking().
Copy link
Member

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

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

LGTM.

I remember a few issues about converting a function to AG caused regressions (e.g different default value for an optional parameter, passing spam=True instead of True raises an exception) in the past, so I wonder if we need to add some tests to make sure that os.{get,set}_blocking() still accepts positional-only arguments or os.readlink(path='some/path') still works.

@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Aug 16, 2018

Thank you for your review.

os.{get,set}_blocking() were added after writing a patch for converting the posix module to Argument Clinic (but before committing it), so they were omitted in the conversion. I don't see any problems with converting them (in contrary to other not converted functions).

AFAIK we don't test path keyword argument for any other os function, and I'm not sure we need to test them. This can limit alternative implementations. Actually the support of keyword arguments for paths was added in 3.3 unintentionally, as a side effect of adding optional keyword-only parameters (like dir_fd or follow_links). Supporting both positional-only and keyword parameters in the same function was not available at that time.

You can see that currently Argument Clinic generates the equivalent parsing code. If this will be broken in future, I'm sure this will break other tests for other functions.

@serhiy-storchaka serhiy-storchaka merged commit 12a69db into python:master Sep 17, 2018
@serhiy-storchaka serhiy-storchaka deleted the clinic-os-readlink branch September 17, 2018 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants