[Python-Dev] [Python-checkins] cpython: Issue #9566: recv(), recvfrom(), send(), sendall() and sendto() methods

Victor Stinner victor.stinner at gmail.com
Tue Jun 25 00:40:14 CEST 2013


Oh, I didn't know that."if defined(MS_WIN64) || defined(MS_WINDOWS)"
is a common pattern in the Python source code. I simplified the #ifdef
in many places:
http://hg.python.org/cpython/rev/dfc020b4b123

I also read that MS_WIN32 is always defined on Windows. "#ifdef
MS_WIN32" (used in many files, especially in ctypes) can probably be
replaced with "#ifdef MS_WINDOWS" for consistency. MS_WIN32 should
only be used to check if the API is Win64:

/* MSVC defines _WINxx to differentiate the windows platform types

   Note that for compatibility reasons _WIN32 is defined on Win32
   *and* on Win64. For the same reasons, in Python, MS_WIN32 is
   defined on Win32 *and* Win64. Win32 only code must therefore be
   guarded as follows:
       #if defined(MS_WIN32) && !defined(MS_WIN64)
   Some modules are disabled on Itanium processors, therefore we
   have MS_WINI64 set for those targets, otherwise MS_WINX64
*/

Victor

2013/6/25 Jeremy Kloth <jeremy.kloth at gmail.com>:
> On Mon, Jun 24, 2013 at 3:48 PM, victor.stinner
> <python-checkins at python.org> wrote:
>> +#if defined(MS_WIN64) || defined(MS_WINDOWS)
>
> This test could be reduced to simply `#ifdef MS_WINDOWS`.  See PC\pyconfig.h


More information about the Python-Dev mailing list