[Python-checkins] cpython (3.4): os.sendfile(headers=None, trailers=None) arguments are not actually accepted

martin.panter python-checkins at python.org
Wed Sep 9 08:31:05 CEST 2015


https://hg.python.org/cpython/rev/e42e2bd47168
changeset:   97801:e42e2bd47168
branch:      3.4
parent:      97798:c51514826126
user:        Martin Panter <vadmium>
date:        Wed Sep 09 05:29:24 2015 +0000
summary:
  os.sendfile(headers=None, trailers=None) arguments are not actually accepted

Needs to be tested on a BSD.

files:
  Doc/library/os.rst    |  2 +-
  Lib/test/test_os.py   |  2 +-
  Modules/posixmodule.c |  6 +++---
  3 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Doc/library/os.rst b/Doc/library/os.rst
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1072,7 +1072,7 @@
 
 
 .. function:: sendfile(out, in, offset, count)
-              sendfile(out, in, offset, count, headers=None, trailers=None, flags=0)
+              sendfile(out, in, offset, count, [headers], [trailers], flags=0)
 
    Copy *count* bytes from file descriptor *in* to file descriptor *out*
    starting at *offset*.
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -2170,7 +2170,7 @@
             **{'in': self.fileno})
         if self.SUPPORT_HEADERS_TRAILERS:
             os.sendfile(self.sockno, self.fileno, offset=0, count=4096,
-                headers=None, trailers=None, flags=0)
+                headers=(), trailers=(), flags=0)
 
     # --- headers / trailers tests
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8246,7 +8246,7 @@
 #ifdef HAVE_SENDFILE
 PyDoc_STRVAR(posix_sendfile__doc__,
 "sendfile(out, in, offset, count) -> byteswritten\n\
-sendfile(out, in, offset, count, headers=None, trailers=None, flags=0)\n\
+sendfile(out, in, offset, count[, headers][, trailers], flags=0)\n\
             -> byteswritten\n\
 Copy count bytes from file descriptor in to file descriptor out.");
 
@@ -8286,7 +8286,7 @@
     if (headers != NULL) {
         if (!PySequence_Check(headers)) {
             PyErr_SetString(PyExc_TypeError,
-                "sendfile() headers must be a sequence or None");
+                "sendfile() headers must be a sequence");
             return NULL;
         } else {
             Py_ssize_t i = 0; /* Avoid uninitialized warning */
@@ -8303,7 +8303,7 @@
     if (trailers != NULL) {
         if (!PySequence_Check(trailers)) {
             PyErr_SetString(PyExc_TypeError,
-                "sendfile() trailers must be a sequence or None");
+                "sendfile() trailers must be a sequence");
             return NULL;
         } else {
             Py_ssize_t i = 0; /* Avoid uninitialized warning */

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list