From f73b402ccabbdba45386cac4be10661b4f2b2f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Fri, 23 Jun 2017 17:51:06 -0400 Subject: [PATCH] bpo-30742 Enabling compiling with VS2015 --- Modules/posixmodule.c | 4 ++++ Modules/timemodule.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index ad505364bda9da..83f411e38eb609 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -570,6 +570,9 @@ extern __declspec(dllimport) char * __pioinfo[]; int _PyVerify_fd(int fd) { +#if (_MSC_VER >= 1900) //VS2015+ + return 1; //rely on other error checking, as __pioinfo is no longer exported +#else const int i1 = fd >> IOINFO_L2E; const int i2 = fd & ((1 << IOINFO_L2E) - 1); @@ -602,6 +605,7 @@ _PyVerify_fd(int fd) fail: errno = EBADF; return 0; +#endif } /* the special case of checking dup2. The target fd must be in a sensible range */ diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 12c43b08fe4a81..88cc958960b0ac 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -705,7 +705,18 @@ inittimezone(PyObject *m) { And I'm lazy and hate C so nyer. */ -#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) +#if defined(HAVE_TZNAME) && (_MSC_VER >= 1900) //VS2015+ + tzset(); + PyModule_AddIntConstant(m, "timezone", _timezone); +#ifdef HAVE_ALTZONE + PyModule_AddIntConstant(m, "altzone", altzone); +#else + PyModule_AddIntConstant(m, "altzone", _timezone-3600); +#endif + PyModule_AddIntConstant(m, "daylight", _daylight); + PyModule_AddObject(m, "tzname", + Py_BuildValue("(zz)", _tzname[0], _tzname[1])); +#elif defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) tzset(); #ifdef PYOS_OS2 PyModule_AddIntConstant(m, "timezone", _timezone);