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

Andrew Bartlett abartlet at samba.org
Fri Feb 24 20:23:07 UTC 2017


On Fri, 2017-02-24 at 17:23 +0100, Stefan Metzmacher wrote:
> Am 22.02.2017 um 18:59 schrieb Andrew Bartlett:
> > On Wed, 2017-02-22 at 18:41 +0100, Stefan Metzmacher wrote:
> > > Am 21.02.2017 um 23:10 schrieb Andrew Bartlett:
> > > > 
> > > > What more needs to be done.  I think porting fully to PyCapsule
> > > > with a
> > > > emulation layer is the correct approach, and would avoid the
> > > > uglier
> > > > changes in the PIDL generated code. 
> > > 
> > > Sorry, but I disagree. We should avoid using PyCapsule and use
> > > pytalloc_GenericObject. It makes the code much simpler.
> > 
> > Indeed it does.  I misunderstood, and assumed this was just another
> > layer that was then on top of PyCapsule to make it nicer.  Instead
> > it
> > avoids the whole CObject/PyCapsule distinction.  Nice!
> > 
> > > I'm currently doing private autobuilds with the attached
> > > patchset,
> > > which removes all usage of PyCObject and uses
> > > pytalloc_GenericObject
> > > instead.
> > > 
> > > Please have look, but don't push it yet.
> > 
> > It certainly looks like a cleaner way to avoid this whole problem.
> > 
> > > I think we may also backport this to 4.6 as the
> > > py_{ex,im}port_union()
> > > framework was new in 4.6 and I think it should be consistent
> > > between
> > > master
> > > and the production 4.6 release.
> > > 
> > > metze
> > 
> > I found one typo in the review:
> > 
> > -_PUBLIC_ void *_pytalloc_get_type(PyObject *py_obj, const char
> > *type_name)
> > +static void *_pytalloc_get_checked_type(PyObject *py_obj, const
> > char
> > *type_name,
> > +					bool check_only, const
> > char
> > *function)
> >  {
> > -	void *ptr = _pytalloc_get_ptr(py_obj);
> > +	TALLOC_CTX *mem_ctx;
> > +	void *ptr = NULL;
> >  	void *type_obj = talloc_check_name(ptr, type_name);
> >  
> > +	mem_ctx = _pytalloc_get_mem_ctx(py_obj);
> > +	ptr = _pytalloc_get_ptr(py_obj);
> > +
> > +	if (mem_ctx != ptr) {
> > +		if (check_only) {
> > +			return NULL;
> > +		}
> > +
> > +		PyErr_Format(PyExc_TypeError, "%s: expected %s, "
> > +			     "but the pointer is no talloc
> > pointer, "
> > +			     "pytalloc_get_ptr() would get the rar
> > pointer.",
> > +			     function, type_name);
> > +		return NULL;
> > +	}
> > +
> > 
> > I think you want s/rar/raw/ or s/rar/wrong/ ?
> > 
> > Finally, I want to say a big thanks to both of you for all your
> > work,
> > patience and persistence on this.  It is great to get this stuff
> > right,
> > rather than just a patched-up continuation of what we had.
> 
> raw :-)
> 
> Here's the patchset including a new talloc version (2.1.9)
> that passed autobuild.
> 
> Please review and push:-)

Pushed to autobuild.  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