Menu

#127 Explicit conversion from PyLong to Variant

Unstable (example)
closed-fixed
nobody
None
5
2013-06-13
2013-05-03
No

Since Python an arbitrary length long it is not easy to determine which VARIANT type is suitable. This patch checks the sign and the size of the long value and converts the long in the following way
x < LLONG_MIN --> VT_R8
LLONG_MIN <= x < LONG_MIN --> VT_I8
LONG_MIN <= x < LONG_MAX --> VT_I4
LONG_MAX < x <= ULONG_MAX --> VT_UI4
ULONG_MAX < x <= LLONG_MAX --> VT_I8
LLONG_MAX < x <= ULLONG_MAX --> VT_UI8
ULLONG_MAX < x --> VT_R8

which adds the conversion to VT_UI8 and is different from the current way:
x < LLONG_MIN --> VT_R8
LLONG_MIN <= x < LONG_MIN --> VT_I8
LONG_MIN <= x < LONG_MAX --> VT_I4
LONG_MAX < x <= ULONG_MAX --> VT_UI4
ULONG_MAX < x <= LLONG_MAX --> VT_I8
LLONG_MAX < x --> VT_R8

Discussion

  • Stefan Schukat

    Stefan Schukat - 2013-05-03

    Long conversion diff.

     
  • Mark Hammond

    Mark Hammond - 2013-06-13
    • status: open --> closed-fixed
    • Group: --> Unstable (example)
     
  • Mark Hammond

    Mark Hammond - 2013-06-13

    4320:cbcbd126551c

     

Log in to post a comment.