[PATCHES] Miscellaneous Python fixes

Noel Power nopower at suse.com
Thu Oct 25 15:27:25 UTC 2018

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.
> Douglas

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

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


More information about the samba-technical mailing list