txdbus icon indicating copy to clipboard operation
txdbus copied to clipboard

Confirm integer marhsalling/unmarshalling

Open exvito opened this issue 7 years ago • 2 comments

Creating this ticket as a follow-up of a not 100% clear matter identified in https://github.com/cocagne/txdbus/pull/65#issuecomment-306827838.

Facts:

  • DBus has several int types, singed/unsigned, from 8- to 64- bit wide.
  • Python 3 unified Python int and longs into a common int. In either case, these are arbitrariliy long and may not fit in a 64-bit wide representation.
  • With #11 and associated tickets some changes have been made which may affect this.

What I'm trying to account for:

  • This code appropriately marshals/unmarshals whichever ints (or longs, in Python 2) into the appropriate DBus types or "fails" in a documented way (i.e.: when marshalling a value that does not fit the destination DBus type).

Maybe this is all correct, maybe not. Just leaving this here for future reference and to be checked by someone (me, who knows?) in the future.

Plan:

  • Ensure tests exist for all combinations of DBus integer types and valid/invalid Python integers for each of those.

exvito avatar Jul 07 '17 12:07 exvito

To sum up a bit:

  • We'll need different code paths on py2 vs py3
  • On py3: always use int.
  • On py2, use long or int (is there anything wrong with always using long?)
  • In the value is over 64-bit wide, raise ValueError.

WhyNotHugo avatar Jul 12 '17 23:07 WhyNotHugo

Quick note: related to #19.

exvito avatar Jul 14 '17 09:07 exvito