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

This commit is contained in:
Kristján Valur Jónsson 2007-04-25 00:17:39 +00:00
parent 17b8e97e2e
commit 67387fb4aa
3 changed files with 4 additions and 2 deletions

View file

@ -849,7 +849,7 @@ bu_longlong(const char *p, const formatdef *f)
} while (--i > 0); } while (--i > 0);
/* Extend the sign bit. */ /* Extend the sign bit. */
if (SIZEOF_LONG_LONG > f->size) 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) if (x >= LONG_MIN && x <= LONG_MAX)
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
return PyLong_FromLongLong(x); return PyLong_FromLongLong(x);
@ -1085,7 +1085,7 @@ lu_longlong(const char *p, const formatdef *f)
} while (i > 0); } while (i > 0);
/* Extend the sign bit. */ /* Extend the sign bit. */
if (SIZEOF_LONG_LONG > f->size) 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) if (x >= LONG_MIN && x <= LONG_MAX)
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
return PyLong_FromLongLong(x); return PyLong_FromLongLong(x);

View file

@ -4,6 +4,7 @@
#include "Python.h" #include "Python.h"
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with winbase.h */
#include "pyarena.h" #include "pyarena.h"
#include "pythonrun.h" #include "pythonrun.h"
#include "errcode.h" #include "errcode.h"

View file

@ -4,6 +4,7 @@
#include "Python.h" #include "Python.h"
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with winbase.h */
#include "grammar.h" #include "grammar.h"
#include "node.h" #include "node.h"
#include "token.h" #include "token.h"