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

Skip to content

Commit 9499413

Browse files
author
Martin Panter
committed
os.sendfile(headers=None, trailers=None) arguments are not actually accepted
Needs to be tested on a BSD.
1 parent 78d915a commit 9499413

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

Doc/library/os.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ or `the MSDN <http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Window
10721072

10731073

10741074
.. function:: sendfile(out, in, offset, count)
1075-
sendfile(out, in, offset, count, headers=None, trailers=None, flags=0)
1075+
sendfile(out, in, offset, count, [headers], [trailers], flags=0)
10761076

10771077
Copy *count* bytes from file descriptor *in* to file descriptor *out*
10781078
starting at *offset*.

Lib/test/test_os.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ def test_keywords(self):
21702170
**{'in': self.fileno})
21712171
if self.SUPPORT_HEADERS_TRAILERS:
21722172
os.sendfile(self.sockno, self.fileno, offset=0, count=4096,
2173-
headers=None, trailers=None, flags=0)
2173+
headers=(), trailers=(), flags=0)
21742174

21752175
# --- headers / trailers tests
21762176

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8246,7 +8246,7 @@ posix_write(PyObject *self, PyObject *args)
82468246
#ifdef HAVE_SENDFILE
82478247
PyDoc_STRVAR(posix_sendfile__doc__,
82488248
"sendfile(out, in, offset, count) -> byteswritten\n\
8249-
sendfile(out, in, offset, count, headers=None, trailers=None, flags=0)\n\
8249+
sendfile(out, in, offset, count[, headers][, trailers], flags=0)\n\
82508250
-> byteswritten\n\
82518251
Copy count bytes from file descriptor in to file descriptor out.");
82528252

@@ -8286,7 +8286,7 @@ posix_sendfile(PyObject *self, PyObject *args, PyObject *kwdict)
82868286
if (headers != NULL) {
82878287
if (!PySequence_Check(headers)) {
82888288
PyErr_SetString(PyExc_TypeError,
8289-
"sendfile() headers must be a sequence or None");
8289+
"sendfile() headers must be a sequence");
82908290
return NULL;
82918291
} else {
82928292
Py_ssize_t i = 0; /* Avoid uninitialized warning */
@@ -8303,7 +8303,7 @@ posix_sendfile(PyObject *self, PyObject *args, PyObject *kwdict)
83038303
if (trailers != NULL) {
83048304
if (!PySequence_Check(trailers)) {
83058305
PyErr_SetString(PyExc_TypeError,
8306-
"sendfile() trailers must be a sequence or None");
8306+
"sendfile() trailers must be a sequence");
83078307
return NULL;
83088308
} else {
83098309
Py_ssize_t i = 0; /* Avoid uninitialized warning */

0 commit comments

Comments
 (0)