diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c
--- a/Modules/errnomodule.c
+++ b/Modules/errnomodule.c
@@ -7,6 +7,33 @@
#ifdef MS_WINDOWS
#define WIN32_LEAN_AND_MEAN
#include
+/* The following constants were added to errno.h in VS2010 but have
+ preferred WSA equivalents. */
+#undef EADDRINUSE
+#undef EADDRNOTAVAIL
+#undef EAFNOSUPPORT
+#undef EALREADY
+#undef ECONNABORTED
+#undef ECONNREFUSED
+#undef ECONNRESET
+#undef EDESTADDRREQ
+#undef EHOSTUNREACH
+#undef EINPROGRESS
+#undef EISCONN
+#undef ELOOP
+#undef EMSGSIZE
+#undef ENETDOWN
+#undef ENETRESET
+#undef ENETUNREACH
+#undef ENOBUFS
+#undef ENOPROTOOPT
+#undef ENOTCONN
+#undef ENOTSOCK
+#undef EOPNOTSUPP
+#undef EPROTONOSUPPORT
+#undef EPROTOTYPE
+#undef ETIMEDOUT
+#undef EWOULDBLOCK
#endif
/*
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2317,6 +2317,34 @@
#ifdef MS_WINDOWS
#include
+/* The following constants were added to errno.h in VS2010 but have
+ preferred WSA equivalents. */
+#undef EADDRINUSE
+#undef EADDRNOTAVAIL
+#undef EAFNOSUPPORT
+#undef EALREADY
+#undef ECONNABORTED
+#undef ECONNREFUSED
+#undef ECONNRESET
+#undef EDESTADDRREQ
+#undef EHOSTUNREACH
+#undef EINPROGRESS
+#undef EISCONN
+#undef ELOOP
+#undef EMSGSIZE
+#undef ENETDOWN
+#undef ENETRESET
+#undef ENETUNREACH
+#undef ENOBUFS
+#undef ENOPROTOOPT
+#undef ENOTCONN
+#undef ENOTSOCK
+#undef EOPNOTSUPP
+#undef EPROTONOSUPPORT
+#undef EPROTOTYPE
+#undef ETIMEDOUT
+#undef EWOULDBLOCK
+
#if defined(WSAEALREADY) && !defined(EALREADY)
#define EALREADY WSAEALREADY
#endif
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -27,6 +27,8 @@
#ifdef _MSC_VER
#if _MSC_VER >= 1500 && _MSC_VER < 1600
#include
+#elif _MSC_VER >= 1600
+#include
#endif
#endif
@@ -464,7 +466,7 @@
PyInit_msvcrt(void)
{
int st;
- PyObject *d;
+ PyObject *d, *version;
PyObject *m = PyModule_Create(&msvcrtmodule);
if (m == NULL)
return NULL;
@@ -494,6 +496,9 @@
#endif
/* constants for the crt versions */
+ /* TODO-BC: the following 3 are from VS2008, may want to remove? */
+ /* XXX-BC: I was unable to find VS2010 replacements for TOKEN and PREFIX
+ constants...not sure what to do with them. */
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
_VC_ASSEMBLY_PUBLICKEYTOKEN);
@@ -510,5 +515,15 @@
if (st < 0) return NULL;
#endif
+ /* constants for the 2010 crt versions */
+#if defined(_VC_CRT_MAJOR_VERSION) && defined (_VC_CRT_MINOR_VERSION) && defined(_VC_CRT_BUILD_VERSION) && defined(_VC_CRT_RBUILD_VERSION)
+ version = PyUnicode_FromFormat("%d.%d.%d.%d", _VC_CRT_MAJOR_VERSION,
+ _VC_CRT_MINOR_VERSION,
+ _VC_CRT_BUILD_VERSION,
+ _VC_CRT_RBUILD_VERSION);
+ st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
+ if (st < 0) return NULL;
+#endif
+
return m;
}