Issue38378
Created on 2019-10-05 15:04 by serhiy.storchaka, last changed 2020-08-24 16:06 by vstinner. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 16742 | merged | serhiy.storchaka, 2019-10-13 08:05 | |
| Messages (6) | |||
|---|---|---|---|
| msg354012 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-10-05 15:04 | |
os.sendfile() has a keyword-or-positional parameter named "in". Since it is a keyword in Python, it is not possible to pass it as a keyword argument. You can only pass it as a positional argument or using a var-keyword argument (unlikely anybody uses the latter). The preceding parameter, "out", also can not be passed by keyword because of this. It is weird, but usually does not cause a problem. You cannot use a keyword argument, period. But it prevents os.sendfile() from converting to Argument Clinic, because Argument Clinic does not allow using Python keywords as parameter names (I already created a patch for conversion, but in needs to solve this issue first). There are two ways to solve this issue. 1. Rename parameter "in" (and maybe "out" for consistency). "out_fd" and "in_fd" look good names (they are use in Linux manpage). 2. Make "out" and "in" positional-only parameters. |
|||
| msg354013 - (view) | Author: Zackery Spytz (ZackerySpytz) * | Date: 2019-10-05 15:11 | |
See also bpo-15078. |
|||
| msg354515 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * | Date: 2019-10-12 01:51 | |
I’m for renaming both. Since the function is about transmitting or copying (on Linux) files src_fd and dst_fd could also be good candidates. |
|||
| msg354571 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-10-13 08:59 | |
New changeset 140a7d1f3579e778656a6b6bfad72489e9870a4d by Serhiy Storchaka in branch 'master': bpo-38378: Rename parameters "out" and "in" of os.sendfile(). (GH-16742) https://github.com/python/cpython/commit/140a7d1f3579e778656a6b6bfad72489e9870a4d |
|||
| msg375853 - (view) | Author: STINNER Victor (vstinner) * | Date: 2020-08-24 16:04 | |
I would prefer "2. Make "out" and "in" positional-only parameters". It would be a minor incompatible change, but it would make os.sendfile() more consistent with other functions like os.write() which only has positional-only parameters. |
|||
| msg375854 - (view) | Author: STINNER Victor (vstinner) * | Date: 2020-08-24 16:06 | |
Well, since os.sendfile(in=fd) raises a syntax error, I don't think that it's really a backward incompatible change in practice. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-08-24 16:06:17 | vstinner | set | messages: + msg375854 |
| 2020-08-24 16:04:40 | vstinner | set | nosy:
+ vstinner messages: + msg375853 |
| 2019-10-13 09:18:44 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-10-13 08:59:36 | serhiy.storchaka | set | messages: + msg354571 |
| 2019-10-13 08:05:45 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request16319 |
| 2019-10-12 01:51:50 | giampaolo.rodola | set | nosy:
+ giampaolo.rodola messages: + msg354515 |
| 2019-10-05 15:11:16 | ZackerySpytz | set | nosy:
+ ZackerySpytz messages: + msg354013 |
| 2019-10-05 15:04:03 | serhiy.storchaka | create | |