]> granicus.if.org Git - python/commitdiff
Hear the #error: change the default value of the mutable_arg argument
authorMichael W. Hudson <mwh@python.net>
Tue, 30 Nov 2004 14:31:54 +0000 (14:31 +0000)
committerMichael W. Hudson <mwh@python.net>
Tue, 30 Nov 2004 14:31:54 +0000 (14:31 +0000)
to ioctl() and remove the warning when it is not supplied.

Doc/lib/libfcntl.tex
Modules/fcntlmodule.c

index df258ee0bcd847f1627ca84c53bc5985b5af15ef..4391d73693f2c610642c3c7cdadba786d406d50f 100644 (file)
@@ -78,11 +78,9 @@ The module defines the following functions:
   long which is then passed to \function{ioctl()} and copied back into
   the supplied buffer.
   
-  If \var{mutate_flag} is not supplied, then in 2.3 it defaults to
-  false.  This is planned to change over the next few Python versions:
-  in 2.4 failing to supply \var{mutate_flag} will get a warning but
-  the same behavior and in versions later than 2.5 it will default to
-  true.
+  If \var{mutate_flag} is not supplied, then from Python 2.5 it
+  defaults to true, which is a change from versions 2.3 and 2.4.
+  Supply the argument explicitly if version portability is a priority.
 
   An example:
 
index 43f1773032317a323181dfdf92ce450936b0291e..54f3a2eb272001df1d300a6bcbcf95c05fdb45ca 100644 (file)
@@ -99,7 +99,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
        int ret;
        char *str;
        int len;
-       int mutate_arg = 0;
+       int mutate_arg = 1;
        char buf[1024];
 
        if (PyArg_ParseTuple(args, "O&iw#|i:ioctl",
@@ -107,16 +107,6 @@ fcntl_ioctl(PyObject *self, PyObject *args)
                             &str, &len, &mutate_arg)) {
                char *arg;
 
-               if (PyTuple_Size(args) == 3) {
-#if (PY_MAJOR_VERSION>2) || (PY_MINOR_VERSION>=5)
-#error Remove the warning, change mutate_arg to 1
-#endif
-                       if (PyErr_Warn(PyExc_FutureWarning,
-       "ioctl with mutable buffer will mutate the buffer by default in 2.5"
-                                   ) < 0)
-                               return NULL;
-                       mutate_arg = 0;
-               }
                if (mutate_arg) {
                        if (len <= sizeof buf) {
                                memcpy(buf, str, len);