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

Andrew Bartlett abartlet at samba.org
Thu Feb 9 03:20:10 UTC 2017


On Thu, 2017-02-09 at 14:20 +1300, Andrew Bartlett wrote:
> 
> > This is really good.  There is a stray PY3 import into
> > samba/__init__.py
> > 
> > The thing that scared me more was the regular expression for
> > expanding
> > the code to call PyCObject_FromVoidPtrAndDesc in pidl :-)
> > 
> > I can see why it was done however, and I don't really mine.
> > 
> > I would really appreciate a second or more set of eyes over this,
> > and
> > I'll get you a formal review shortly after more examination, but
> > I'm
> > reasonably comfortable with how this is landing!
> 
> I'm hitting (due to our strict build, please build with --enable-
> developer):
> 
> ../lib/talloc/pytalloc_util.c: In function
> ‘pytalloc_PyCapsule_FromTallocPtr’:
> ../lib/talloc/pytalloc_util.c:201:34: error: passing argument 3 of
> ‘PyCapsule_New’ from incompatible pointer type [-Werror=incompatible-
> pointer-types]
>   return PyCapsule_New(ptr, NULL, py_cobject_talloc_free);
>                                   ^~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/python3.5m/Python.h:96:0,
>                  from ../lib/talloc/pytalloc_util.c:20:
> /usr/include/python3.5m/pycapsule.h:28:24: note: expected
> ‘PyCapsule_Destructor {aka void (*)(struct _object *)}’ but argument
> is
> of type ‘void (*)(void *)’
>  PyAPI_FUNC(PyObject *) PyCapsule_New(
> 
> This is because we are so strict we care about the difference between
> fn(void *) and fn(PyObject *).
> 
> The other issue I hit is: 
>                         ^~~~~~~~~~~~~
> In file included from ../source4/param/pyparam_util.c:21:0:
> ../python/py3compat.h:179:0: error: "PyCapsule_CheckExact" redefined
> [-
> Werror]
>  #define PyCapsule_CheckExact(capsule) (PyCObject_Check(capsule))
>  
> 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?

I've decided to have a stab at this.  Please look at this rough re-
working of your patch set, and if you are happy I'll tidy it up and get
some review into master.

Thanks!

Andrew Bartlett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py3.patch
Type: text/x-patch
Size: 206269 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170209/32f3f1ba/py3-0001.bin>


More information about the samba-technical mailing list