[Patches] [ python-Patches-500981 ] thread_nt.h weird prototype

noreply@sourceforge.net noreply@sourceforge.net
Tue, 08 Jan 2002 12:13:54 -0800


Patches item #500981, was opened at 2002-01-08 11:44
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=500981&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason Orendorff (jorend)
Assigned to: Nobody/Anonymous (nobody)
Summary: thread_nt.h weird prototype

Initial Comment:
Python/thread_nt.h gives a prototype of 
InterlockedCompareExchange that (strangely) disagrees 
with the MSDN definition of the API.

In python/dist/src/Python/thread_nt.h, line 19:
  typedef PVOID WINAPI interlocked_cmp_xchg_t(PVOID 
*dest, PVOID exc, PVOID comperand) ;

But:
  // According to MSDN
  LONG InterlockedCompareExchange( 
    LPLONG volatile Destination,  // destination 
address
    LONG Exchange,                // exchange value
    LONG Comperand                // value to compare
  );

Later on in the file, when the function actually gets 
called, the code contains a bunch of casts to 
compensate for the fact that the prototype is wrong!  
How weird is that?

I've attached a patch that fixes the wacky prototype 
in question.  (I built Python with it and ran the 
regression tests; everything works.)


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2002-01-08 12:13

Message:
Logged In: YES 
user_id=31435

Whatever MSDN may say, the prototype in the code matches 
what's actually in MS's winbase.h (at least under MSVC 6).  
This makes it too confused for me to even want to think 
about it -- maybe one of the thread_nt.h authors (listed at 
the top of the file) could be provoked into explaining what 
they believe.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=500981&group_id=5470