[PATCH] Porting Samba's CPython extensions to Python 3

Andrew Bartlett abartlet at samba.org
Fri Jul 29 19:43:14 UTC 2016


On Thu, 2016-07-14 at 11:56 +0200, Petr Viktorin wrote:
> On 07/11/2016 05:21 PM, Stefan Metzmacher wrote:
> > 
> > Hi Petr,
> > 
> > > 
> > > Sorry for the delay – I've been working on porting FreeIPA for a
> > > few
> > > months.
> > > 
> > > I've spoken with Alexander Bokovoy earlier, and we agreed that
> > > adding a
> > > third_party module might be too much overhead for what is
> > > essentially a
> > > single header file.
> > > 
> > > So, I present two options, and I'm attaching patches that port
> > > the
> > > "samba.credentials" module as example usage.
> > > - third_party/py3c, a copy of the (MIT-licensed) py3c project,
> > > with
> > > corresponding build system integration. (I'm not sure if I did
> > > the
> > > integration correctly; there's probably a better way to add a
> > > header-only third-party library to Waf-samba)
> > > - lib/py3compat.h, a relatively simple header with the necessary
> > > macros.
> > > (I forked this from py3c when I was still the sole author, but
> > > the
> > > latter additions are not relevant to Samba.)
> > 
> > I'd prefer a single py3compat.h it's simple enough, but I'd located
> > it under
> > python/ or python/compat/ instead of lib/
> > 
> > metze
> 
> 
> That does sound better. Here is a patchset that puts the header in
> python/.

These patches look really good.  However, I do wonder if we could have
some tests?  

I realise that there are not good tests for the credentials API right
now, but one of the great things I've really appricated from your work
so far is that the python3 port has been coupled with improved tests
overall, ensuring both no regression and test coverage going forward!

This is particularly important to me for things like .get_nt_hash(),
because that is where we start to deal with the hard stuff - the
difference between unicode and bytes. 

Once this is in, I'm also keen to see how you plan to tackle the pidl
generated code, as that is where we have traditionally had the most
problems.

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list