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

Petr Viktorin pviktori at redhat.com
Thu Feb 9 15:10:04 UTC 2017


On 02/09/2017 03:55 PM, 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.

>
> At least I seem to have thought about something like this (maybe the
> reverse) here
> https://git.samba.org/?p=samba.git;a=commitdiff;h=e0324c0cf7e7c363a579
>
> +               ##
> +               ## PyCapsule (starting with 2.7) vs. PyCObject (up to 3.2)
> +               ##
> +               ## As we need to support python 2.6, we can't use
> PyCapsule yet.
> +               ##
> +               ## When we'll get support fpr Python3 we'll have to emulate
> +               ## PyCObject using PyCapsule and convert these functions to
> +               ## use PyCapsule.
> +               ##
>
> metze
>


-- 
Petr Viktorin



More information about the samba-technical mailing list