[PATCH] Python3 compatible modules - credentials, param, _glue
Lumir Balhar
lbalhar at redhat.com
Thu Feb 23 19:38:56 UTC 2017
On 02/22/2017 06:59 PM, Andrew Bartlett wrote:
> 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.
>
> Thanks,
>
> Andrew Bartlett
>
Hello.
We had a meeting with Petr and now I understand why the last proposed
changes are necessary to make to improve design of pytalloc.
However, to be honest, I don't want the changes to be part of this
patchset, along with a lot of modules ported to Python 3.
After every simple change, I have to rebase all the patches, fix issues,
resolve conflicts, build it, test it, build and test it again on Centos
6 with Python 2.6 etc. This is very time consuming and I did it many
times (more than I expected).
So, from my point of view, it would be better to finalize Stefan's patch
and merge it to master, and then I can rework my patchset (the last
time, hopefully) to be compatible with the latest pytalloc API.
What do you think about it?
Have a nice day.
LumÃr
More information about the samba-technical
mailing list