[PATCH] Python3 compatible tests and credentials module

Andrew Bartlett abartlet at samba.org
Fri Nov 25 02:40:26 UTC 2016

On Thu, 2016-11-24 at 14:59 +0100, Lumir Balhar wrote:
> Hello.
> Because I have no response for two weeks on GitHub [0], I decided to 
> send my patches here. Which way is preferred, please?
> The first part of this PR contains changes necessary to run tests
> with 
> Python 3. These changes should not have any impact on functionality
> with 
> Python 2.
> The second part ports the samba.credentials module to be Python 3 
> compatible, and also ports the credentials tests. The files
> py3compat.h 
> and compat.py will help us with porting and to make the future code
> more 
> readable. The py3compat.h file is the same as proposed by Petr
> Viktorin 
> and discussed in this thread: 
> https://lists.samba.org/archive/samba-technical/2016-July/114998.html
> I am submitting the two parts as one PR because, without at least
> one 
> module prepared for Python 3, it is impossible to try running tests
> with 
> Python 3.
> [0] https://github.com/samba-team/samba/pull/68

Thanks for the patch.  The main thing I don't like is the if PY3 stuff,
and the .args usage.  I would rather we ported param and glue to
python3 at the same time, they shouldn't be too hard. 

Please use 

(enum, estr) = e

rather than 

enum = e.args[0], or better still help us find a way to have LdbError
(and the other error exceptions) return an object we can both de-
construct in this way, as well as something more friendly like e.enum.


Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba-technical mailing list