[Python-checkins] r42787 - python/trunk/Modules/fcntlmodule.c

thomas.wouters python-checkins at python.org
Thu Mar 2 18:58:28 CET 2006


Author: thomas.wouters
Date: Thu Mar  2 18:58:27 2006
New Revision: 42787

Modified:
   python/trunk/Modules/fcntlmodule.c
Log:

Explain why we use the unsigned int format for a signed int variable.
(Should 'code' be cast to the right pointer type?)



Modified: python/trunk/Modules/fcntlmodule.c
==============================================================================
--- python/trunk/Modules/fcntlmodule.c	(original)
+++ python/trunk/Modules/fcntlmodule.c	Thu Mar  2 18:58:27 2006
@@ -96,6 +96,10 @@
 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;


More information about the Python-checkins mailing list