summaryrefslogtreecommitdiffstats
path: root/buggy.c
blob: 96d8ab376cf6d7bfbcf5b8fca5fcaa037e8a89f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* 
   Errroneus argument parsing of socket.htons() on 64bit big endian
   machines.

   Fixed in svn r34931
*/

static PyObject *
socket_htons(PyObject *self, PyObject *args)
{
	unsigned long x1, x2;

	if (!PyArg_ParseTuple(args, "i:htons", &x1)) {
		return NULL;
	}
	x2 = (int)htons((short)x1);
	return PyInt_FromLong(x2);
}