Fix problems in x64 build that were discovered by the testsuite:
- Reenable modules on x64 that had been disabled aeons ago for Itanium.
- Cleared up confusion about compilers for 64 bit windows. There is only Itanium and x64. Added macros MS_WINI64 and MS_WINX64 for those rare cases where it matters, such as the disabling of modules above.
- Set target platform (_WIN32_WINNT and WINVER) to 0x0501 (XP) for x64, and 0x0400 (NT 4.0) otherwise, which are the targeted minimum platforms.
- Fixed thread_nt.h. The emulated InterlockedCompareExchange function didn´t work on x64, probaby due to the lack of a "volatile" specifier. Anyway, win95 is no longer a target platform.
- Itertools module used wrong constant to check for overflow in count()
- PyInt_AsSsize_t couldn't deal with attribute error when accessing the __long__ member.
- PyLong_FromSsize_t() incorrectly specified that the operand were unsigned.
With these changes, the x64 passes the testsuite, for those modules present.
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index f2ef7f95..10d929a 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -128,6 +128,8 @@
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
*/
#ifdef _WIN64
#define MS_WIN64
@@ -135,17 +137,28 @@
/* set the COMPILER */
#ifdef MS_WIN64
-#ifdef _M_IX86
-#define COMPILER _Py_PASTE_VERSION("64 bit (Intel)")
-#elif defined(_M_IA64)
+#if defined(_M_IA64)
#define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)")
-#elif defined(_M_AMD64)
-#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
+#define MS_WINI64
+#elif defined(_M_X64)
+#define COMPILER _Py_PASTE_VERSION("64 bit (x64)")
+#define MS_WINX64
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
#endif
#endif /* MS_WIN64 */
+/* set the version macros for the windows headers */
+#ifdef MS_WINX64
+/* 64 bit only runs on XP or greater */
+#define _WIN32_WINNT 0x0501
+#define WINVER 0x0501
+#else
+/* NT 4.0 or greater required otherwise */
+#define _WIN32_WINNT 0x0400
+#define WINVER 0x0400
+#endif
+
/* _W64 is not defined for VC6 or eVC4 */
#ifndef _W64
#define _W64