diff options
author | Thomas Wouters <thomas@python.org> | 2006-03-02 17:58:27 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-03-02 17:58:27 (GMT) |
commit | 857b300b2e1c2b27af84d6090ed4810df00f1b16 (patch) | |
tree | 4b5e3ddc4b7b3908f28d483d6de96a8556c0f3a2 /Modules | |
parent | 4954b384e48701da5f32e55ba664eeeff74703ce (diff) | |
download | cpython-857b300b2e1c2b27af84d6090ed4810df00f1b16.zip cpython-857b300b2e1c2b27af84d6090ed4810df00f1b16.tar.gz cpython-857b300b2e1c2b27af84d6090ed4810df00f1b16.tar.bz2 |
Explain why we use the unsigned int format for a signed int variable.
(Should 'code' be cast to the right pointer type?)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/fcntlmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index d109e29..a368494 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -96,6 +96,10 @@ static PyObject * fcntl_ioctl(PyObject *self, PyObject *args) { int fd; + /* In PyArg_ParseTuple below, use the unsigned int 'I' format for + the signed int 'code' variable, because Python turns 0x8000000 + into a large positive number (PyLong, or PyInt on 64-bit + platforms,) whereas C expects it to be a negative int */ int code; int arg; int ret; |