[New-bugs-announce] [issue9629] SIZEOF_SOCKET_T used in longobject.h but undefined

Antoine Pitrou report at bugs.python.org
Tue Aug 17 20:50:13 CEST 2010


New submission from Antoine Pitrou <pitrou at free.fr>:

longobject.h uses SIZEOF_SOCKET_T:

#if SIZEOF_SOCKET_T <= SIZEOF_LONG
#define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd))
#define PyLong_AsSocket_t(fd) (SOCKET_T)PyLong_AsLong(fd)
#else
#define PyLong_FromSocket_t(fd) PyLong_FromLongLong(((SOCKET_T)(fd));
#define PyLong_AsSocket_t(fd) (SOCKET_T)PyLong_AsLongLong(fd)
#endif

but SIZEOF_SOCKET_T doesn't exist at that point since it is defined in Modules/socketmodule.h which isn't part of Include/Python.h. As a result, PyLong_FromSocket_t is always aliased to PyLong_FromLong, which is wrong under 64-bit Windows (a SOCKET is 64-bit there, while a long is 32-bit).

----------
components: Extension Modules
messages: 114144
nosy: brian.curtin, christian.heimes, pitrou, tim.golden
priority: normal
severity: normal
stage: needs patch
status: open
title: SIZEOF_SOCKET_T used in longobject.h but undefined
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9629>
_______________________________________


More information about the New-bugs-announce mailing list