[issue38378] os.sendfile() has improperly named parameter

Serhiy Storchaka report at bugs.python.org
Sat Oct 5 11:04:03 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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.

----------
components: Extension Modules
messages: 354012
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: os.sendfile() has improperly named parameter
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38378>
_______________________________________


More information about the Python-bugs-list mailing list