From 67387fb4aadbbe1dbb498398b0786ca01d92552e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Wed, 25 Apr 2007 00:17:39 +0000 Subject: [PATCH] Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h --- Modules/_struct.c | 4 ++-- Python/import.c | 1 + Python/pythonrun.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/_struct.c b/Modules/_struct.c index a4c82f7653..78e88b0312 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -849,7 +849,7 @@ bu_longlong(const char *p, const formatdef *f) } while (--i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); + x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); @@ -1085,7 +1085,7 @@ lu_longlong(const char *p, const formatdef *f) } while (i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); + x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); diff --git a/Python/import.c b/Python/import.c index 9151762081..383b6b20b1 100644 --- a/Python/import.c +++ b/Python/import.c @@ -4,6 +4,7 @@ #include "Python.h" #include "Python-ast.h" +#undef Yield /* undefine macro conflicting with winbase.h */ #include "pyarena.h" #include "pythonrun.h" #include "errcode.h" diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 3e5ecfe3f6..96602ff15b 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -4,6 +4,7 @@ #include "Python.h" #include "Python-ast.h" +#undef Yield /* undefine macro conflicting with winbase.h */ #include "grammar.h" #include "node.h" #include "token.h" -- 2.40.0