mhammond / pywin32

Python for Windows (pywin32) Extensions
4.91k stars 783 forks source link

Empty Array generate an error if transported via COM #912

Closed ghost closed 6 years ago

ghost commented 20 years ago

The new code for arbitrary SafeArrays wont allow the transport of empty array. To resolve this problem an else clause has to be added to oleargs.cpp in PyCom_CalculatePyObjectDimension

if (!PyBuffer_Check(obItemCheck) &&
PySequence_Length(obItemCheck)) { ... } // New Code else { // Just an empty list so increase Dimension lReturnDimension += 1; } // End new Code

Reported by: sschukat

Original Ticket: "pywin32/patches/38":https://sourceforge.net/p/pywin32/patches/38

ghost commented 19 years ago

Original comment by: mhammond

ghost commented 19 years ago

Logged In: YES user_id=14198

Can you please attach a test case that fails with the current code? eg, I changed testvb.py to add:

# Empty array _DoTestArray(vbtest, ()) # Empty child array _DoTestArray(vbtest, ((), ()))

Further, I can't find the code you reference in oleargs.cpp - if you still believe it must be added, can you supply a patch (or the entire file if necessary)

Original comment by: mhammond