diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-02-25 16:15:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 16:15:04 -0800 |
commit | 0b3019a02e60171e9b7edb261e1234109001819c (patch) | |
tree | e7a13c2f7d77fd606b64cd83be301b95dde6cfd0 /Modules | |
parent | ea199b90bb61866cd3c2f154341d1eb0d5c4a710 (diff) | |
download | cpython-git-0b3019a02e60171e9b7edb261e1234109001819c.tar.gz |
bpo-24643: Fix "GH-define timezone _timezone" clashes on Windows (GH-12019)
(cherry picked from commit 6673decfa0fb078f60587f5cb5e98460eea137c2)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/timemodule.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index bbfb7db7ab..ae7de5b2c7 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -38,6 +38,16 @@ # include <sanitizer/msan_interface.h> #endif +#ifdef _MSC_VER +#define _Py_timezone _timezone +#define _Py_daylight _daylight +#define _Py_tzname _tzname +#else +#define _Py_timezone timezone +#define _Py_daylight daylight +#define _Py_tzname tzname +#endif + #define SEC_TO_NS (1000 * 1000 * 1000) /* Forward declarations */ @@ -1554,18 +1564,18 @@ init_timezone(PyObject *m) #if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) PyObject *otz0, *otz1; tzset(); - PyModule_AddIntConstant(m, "timezone", timezone); + PyModule_AddIntConstant(m, "timezone", _Py_timezone); #ifdef HAVE_ALTZONE PyModule_AddIntConstant(m, "altzone", altzone); #else - PyModule_AddIntConstant(m, "altzone", timezone-3600); + PyModule_AddIntConstant(m, "altzone", _Py_timezone-3600); #endif - PyModule_AddIntConstant(m, "daylight", daylight); - otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape"); + PyModule_AddIntConstant(m, "daylight", _Py_daylight); + otz0 = PyUnicode_DecodeLocale(_Py_tzname[0], "surrogateescape"); if (otz0 == NULL) { return -1; } - otz1 = PyUnicode_DecodeLocale(tzname[1], "surrogateescape"); + otz1 = PyUnicode_DecodeLocale(_Py_tzname[1], "surrogateescape"); if (otz1 == NULL) { Py_DECREF(otz0); return -1; |