[PATCHES] Miscellaneous Python fixes
douglas.bagnall at catalyst.net.nz
Thu Oct 25 20:39:23 UTC 2018
Thanks for the reviews!
On 26/10/18 4:27 AM, Noel Power wrote:
> On 25/10/2018 10:47, Douglas Bagnall via samba-technical wrote:
>> These are mainly for Python 3 compatibility.
>> CI: https://gitlab.com/samba-team/devel/samba/pipelines/34246431
>> but again I have edited the series since that, because I noticed
>> I had sent one of the patches in an earlier batch.
> I didn't push the first 3 patches, RB+ for the rest (and again pushed to
> For the PATCH 01 & PATCH 02 I didn't take them because there is some
> crossover with https://gitlab.com/samba-team/samba/merge_requests/69 I
> mailed about review for this one before (and I've just rebased it against
> current master just now)
> I'm not sure even about my own changes there but this was the best I could
> do for this test to get it to work for python3. Some of your changes
> conflict (and in one case I have removed code you are patching) Any help
> reviewing that merge request would be great
OK, I will have a look.
> For PATCH 03
> - utf16pw = unicode('"' + password.encode('utf-8') + '"',
> + utf16pw = text_type('"' + password.encode('utf-8') + '"',
> hmm I think this is an encoding/decoding mess (I admit the whole
> encode/decode thing hurts my head at times), the problem is I think the
> orig code is probably wrong too
> at the very least it should be utf16pw = text_type(b'"' +
> password.encode('utf-8') + b'"', 'utf-8').encode('utf-16-le')
> otherwise in Python3 we will be trying to combine a str with byte
> in this case I *think*
> utf16pw = text_type('"' + password + '"', 'utf8').encode('utf-16-le')
> should be sufficient or even
> utf16pw = text_type('"' + password + '"').encode('utf-16-le')
> as I doubt the encoding is really important for the strings we are using
Yes. The trouble is the correct formulation looks like something we should
never be doing, which makes it hard to distinguish from the incorrect
formulations we really should never be doing.
Perhaps we need a helper function.
More information about the samba-technical