From 7e75f1aafba2e34ed5daef9e633684cf173f7a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 15 Apr 2006 08:35:59 +0000 Subject: Patch #1191065: Fix preprocessor problems on systems where recvfrom is a macro. --- Misc/NEWS | 3 +++ Modules/socketmodule.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 4822150..22dbc9c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -48,6 +48,9 @@ Core and builtins Extension Modules ----------------- +- Patch #1191065: Fix preprocessor problems on systems where recvfrom + is a macro. + - Bug #1467952: os.listdir() now correctly raises an error if readdir() fails with an error condition. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index bb5150f..93cb8e0 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2208,18 +2208,20 @@ sock_recvfrom(PySocketSockObject *s, PyObject *args) Py_BEGIN_ALLOW_THREADS memset(&addrbuf, 0, addrlen); timeout = internal_select(s, 0); - if (!timeout) - n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, + if (!timeout) { #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) - (struct sockaddr *) &addrbuf, &addrlen + n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, + (struct sockaddr *) &addrbuf, &addrlen); #else - (void *) &addrbuf, &addrlen + n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, + (void *) &addrbuf, &addrlen); #endif #else - (struct sockaddr *) &addrbuf, &addrlen + n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, + (struct sockaddr *) &addrbuf, &addrlen); #endif - ); + } Py_END_ALLOW_THREADS if (timeout) { -- cgit v0.12