Python3 misc bugfixes

Noel Power nopower at
Tue Mar 6 21:25:50 UTC 2018

Hi Douglas
On 06/03/18 21:05, Douglas Bagnall via samba-technical wrote:
> hi Noel,
>> I am not sure what you mean, do you mean you wish it to be able to
>> handle both str and byte in py3 as input params? If so isn't this just
>> trying to subvert what python3 tries to do (however painful it actually
>> is) to properly distinguishing bytes and strings.
> The counterargument is that the string representation of GUID is
> unambiguous and essentially identical whether it is str or bytes, so
> why not accept both?
see below
>> Additionally this doesn't sound right since the c api that is
>> wrapped is GUID_from_data_blob not GUID_from_string. While the
>> python2 usage of string is handy it isn't correct (from a python3
>> perspective)
> Doesn't PyStr_AsUTF8AndSize() handle exactly this?
> Without the chance of ambiguity through character sets etc, this seems
> a bit like arguing against accepting int when you want float. A little
> bit of DWIM will cause less annoyance and no actual problems.
That's the nub of the problem, the underlying c-api
'GUID_from_data_blob' handles not only a string representation (3
different types it looks like) but additionally it will handle a a
proper 16 byte array representation of the GUID. Disambiguating str &
byte for python3 only would be ugly and imo wrong (given the api that is
being wrapped).

Just let me know if it is really what you want. (In anycase I probably
should update the test to demonstrate the various guid formats too)


More information about the samba-technical mailing list