[Python-checkins] cpython (merge 3.4 -> default): Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian

serhiy.storchaka python-checkins at python.org
Mon Nov 10 10:29:55 CET 2014


https://hg.python.org/cpython/rev/2d203a0b7908
changeset:   93455:2d203a0b7908
parent:      93452:8111ee79d27c
parent:      93454:45e8aed69767
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Nov 10 11:25:50 2014 +0200
summary:
  Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian
platforms.

files:
  Misc/NEWS             |  3 +++
  Modules/fcntlmodule.c |  6 +++---
  2 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -183,6 +183,9 @@
 Library
 -------
 
+- Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian
+  platforms.
+
 - Issue #21650: Add an `--sort-keys` option to json.tool CLI.
 
 - Issues #814253, #9179: Group references and conditional group references now
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -60,7 +60,7 @@
 fcntl_fcntl_impl(PyModuleDef *module, int fd, int code, PyObject *arg)
 /*[clinic end generated code: output=afc5bfa74a03ef0d input=4850c13a41e86930]*/
 {
-    int int_arg = 0;
+    unsigned int int_arg = 0;
     int ret;
     char *str;
     Py_ssize_t len;
@@ -88,7 +88,7 @@
 
         PyErr_Clear();
         parse_result = PyArg_Parse(arg,
-            "l;fcntl requires a file or file descriptor,"
+            "I;fcntl requires a file or file descriptor,"
             " an integer and optionally a third integer or a string",
             &int_arg);
         if (!parse_result) {
@@ -97,7 +97,7 @@
     }
 
     Py_BEGIN_ALLOW_THREADS
-    ret = fcntl(fd, code, int_arg);
+    ret = fcntl(fd, code, (int)int_arg);
     Py_END_ALLOW_THREADS
     if (ret < 0) {
         PyErr_SetFromErrno(PyExc_IOError);

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


More information about the Python-checkins mailing list