projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4954b38
)
Explain why we use the unsigned int format for a signed int variable.
author
Thomas Wouters
<thomas@python.org>
Thu, 2 Mar 2006 17:58:27 +0000
(17:58 +0000)
committer
Thomas Wouters
<thomas@python.org>
Thu, 2 Mar 2006 17:58:27 +0000
(17:58 +0000)
(Should 'code' be cast to the right pointer type?)
Modules/fcntlmodule.c
patch
|
blob
|
history
diff --git
a/Modules/fcntlmodule.c
b/Modules/fcntlmodule.c
index d109e29e7c94e626254583990fd09311568ba19a..a368494c969681d53ae068a1062491d1109f25df 100644
(file)
--- 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;