gh-132742: Refactor fcntl.fcntl() and fcntl.ioctl() #132768
gh-132742: Refactor fcntl.fcntl() and fcntl.ioctl() #132768serhiy-storchaka merged 4 commits intopython:mainfrom
Conversation
e42daf4 to
29cb8b9
Compare
29cb8b9 to
ec30275
Compare
|
@vstinner, could you please take a look? Other changes are planned for other PRs. |
| char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */ | ||
| if (mutate_arg && !PyBytes_Check(arg) && !PyUnicode_Check(arg)) { | ||
| if (PyObject_GetBuffer(arg, &view, PyBUF_WRITABLE) == 0) { | ||
| if (view.len <= IOCTL_BUFSZ) { |
There was a problem hiding this comment.
There are many indentation levels (nested if), did you consider to split this code into sub-functions?
Co-authored-by: Victor Stinner <vstinner@python.org>
|
Thank you for your review, @vstinner. I just tried to split the code on smaller functions. This adds many duplications: declarations of local variables |
|
📚 Documentation preview 📚: https://cpython-previews--132768.org.readthedocs.build/