Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10599/com/win32com/src
Modified Files:
oleargs.cpp
Log Message:
Use VT_I4 if possible when converting a Python int, so to revert to
build 208's behaviour. We now only pass VT_UI4 if it doesn't fit in the
signed version. Fixes [ 1582720 ] Python long integers aren't translated
to Variant/long
Index: oleargs.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** oleargs.cpp 24 May 2007 06:01:04 -0000 1.38
--- oleargs.cpp 27 Aug 2007 08:38:43 -0000 1.39
***************
*** 77,87 ****
} else {
// 64 bits is OK - but if it fits in 32 we will
! // use that.
! if (lval >= 0 && lval <= ULONG_MAX) {
! V_VT(var) = VT_UI4;
! V_UI4(var) = (unsigned long)lval;
! } else if (lval >= LONG_MIN && lval <= LONG_MAX) {
V_VT(var) = VT_I4;
V_I4(var) = (long)lval;
} else {
V_VT(var) = VT_I8;
--- 77,89 ----
} else {
// 64 bits is OK - but if it fits in 32 we will
! // use that. Prefer VT_I4 if possible as VBScript
! // etc like it better.
! if (lval >= LONG_MIN && lval <= LONG_MAX) {
V_VT(var) = VT_I4;
V_I4(var) = (long)lval;
+ // OK, we know it must be > LONG_MAX, but zero is clearer
+ } else if (lval >= 0 && lval <= ULONG_MAX) {
+ V_VT(var) = VT_UI4;
+ V_UI4(var) = (unsigned long)lval;
} else {
V_VT(var) = VT_I8;
|