]> granicus.if.org Git - python/commitdiff
Warn abou missing mutate flag to ioctl. Fixes #696535.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 3 Jun 2004 12:47:26 +0000 (12:47 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 3 Jun 2004 12:47:26 +0000 (12:47 +0000)
Doc/whatsnew/whatsnew24.tex
Misc/NEWS
Modules/fcntlmodule.c

index a39497188aae6416b5c2a4da143e81a7ce1d9b74..638eadb9eff0aceba9d7a49d6fd1b37a0c388ce4 100644 (file)
@@ -669,6 +669,8 @@ changes to your code:
   system ID in the wrong order.  This has been corrected; applications
   relying on the wrong order need to be fixed.
 
+\item \function{fcntl.ioctl} now warns if the mutate arg is omitted.
+
 \end{itemize}
 
 
index a4dd8a1670833756efefed7c784c6fe36972df01..304c3be92dc488f43e126479f6538b589949bc66 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -214,6 +214,8 @@ Core and builtins
 Extension modules
 -----------------
 
+- fcntl.ioctl now warns if the mutate flag is not specified.
+
 - nt now properly allows to refer to UNC roots, e.g. in nt.stat().
 
 - the weakref module now supports additional objects:  array.array,
index 9894c4307e04eb3b8459aeaeb025c073420e7e1e..43f1773032317a323181dfdf92ce450936b0291e 100644 (file)
@@ -108,7 +108,13 @@ fcntl_ioctl(PyObject *self, PyObject *args)
                char *arg;
 
                if (PyTuple_Size(args) == 3) {
-                       /* warning goes here in 2.4 */
+#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) {