[PATCH] Python3 compatible modules - credentials, param, _glue

Andrew Bartlett abartlet at samba.org
Thu Feb 9 21:28:23 UTC 2017


On Thu, 2017-02-09 at 17:18 +0100, Stefan Metzmacher wrote:
> Hi Petr,
> 
> > > > > I've started a thread to have us move to just using PyCapsule
> > > > > by
> > > > > requiring 2.7.  I think this is likely to get up, but we will
> > > > > know
> > > > > soon.  This will kill a number of birds with one stone, so
> > > > > can you re-
> > > > > work the patches to rely on PyCapsule?
> > > > 
> > > > Requiring 2.7 is two questions in one:
> > > > - the minimum version for Samba
> > > > - the minimum version for independent libraries like pytalloc
> > > > 
> > > > But thinking about this, I realized pytalloc can
> > > > - export pytalloc_CObject_FromTallocPtr for Python 2
> > > > - export pytalloc_PyCapsule_FromTallocPtr for Python 3 *and*
> > > > 2.7
> > > > 
> > > > Then Samba could use only PyCapsule (if it doesn't need 2.6
> > > > compatibility), while talloc maintains backwards compatibility.
> > > 
> > > Maybe to naive, but can't we somehow simulate PyCapsule on top of
> > > CObject for 2.6?
> > > And use PyCapsule everywhere in the code?
> > 
> > That's roughly what the proposed patchset does -- it even
> > references the
> > comment below. It's possible, but not particularly pretty.
> 
> Why I had a brief look and everything but PyCapsule_Import() should
> be
> pretty easy
> to similate on top of PyCObject.
> 
> In the last patchset from Andrew I'm wondering why
> PyCapsulate_GetContext() is used,
> I'd guess PyCObject_GetDesc should be replaced by
> PyCapsule_GetName().
> 
> I don't think we actually need PyCapsulate_{Get,Set}Context() for our
> usage.
> PyCapsule_New() and PyCapsule_GetPointer() should be enough.
> I only used PyCObject_GetDesc() because PyCObject_AsVoidPtr() doesn't
> have
> a way to check the description.

I'm afraid this is all a little above my head right now.  I was just
trying to un-wrap it, but clearly I need to read up on this area.

> Something like this should work and provide PyCapsulate
> for all samba callers even with python 2.6

I'm happy with whatever outcome you and Petr think is best, because my
primary goal is to get this in to master, but my preference would be to
actually expect Python from 2010 rather than still support Python from
2008.  

In particular, I would really like to avoid unnecessary wrappers: if we
have reason to expect we can write a wrapper, perhaps only add it if we
get substantial negative feedback on the 2.7 requirement when Samba 4.7
is released in September?

Thanks,

Andrew Bartlett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 862 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170210/f336e3f0/signature.sig>


More information about the samba-technical mailing list