[python-win32] Bug in pywin32's oleargs.cpp ?

Thomas Heller theller at python.net
Tue Mar 15 13:47:39 CET 2005


I'm looking into com\win32com\src\oleargs.cpp, in function
PyCom_VariantFromPyObject, near line 65.  This code converts a Python
object into a VARIANT.

        else if (PyLong_Check(obj))
        {
                double dval = PyLong_AsDouble(obj);
                BOOL isDword = FALSE;
                if (dval >= 0 && dval < (double)ULONG_MAX)
                {
                        DWORD dwval = (DWORD)dval;
                        if ((double)dwval == dval)
                        {
=>                              V_VT(var) = VT_I4;
=>                              V_I4(var) = dwval;
                                isDword = TRUE;
                        }
                }
                if (!isDword)
                {
                        V_VT(var) = VT_R8;
                        V_R8(var) = dval;
                }
        }

Shouldn't the lines marked '=>' use VT_UI4 instead of VT_I4?

Thomas



More information about the Python-win32 mailing list