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

Lumir Balhar lbalhar at redhat.com
Fri Feb 17 13:56:28 UTC 2017


On 02/10/2017 07:30 PM, Andrew Bartlett wrote:
> On Fri, 2017-02-10 at 15:21 +0100, Petr Viktorin wrote:
>> On 02/09/2017 10:28 PM, Andrew Bartlett wrote:
>>> 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?
>> So as far as I see, it would be best to rework the patch to only use
>> PyCapsule (except pytalloc, which should provide constructors for
>> both
>> Capsule and CObject). If it turns out PyCObject support is needed,
>> it
>> can be added with a simple (but unsightly) set of macros/wrappers in
>> a
>> new commit, which would then also be easier to revert.
> That sounds like a plan.  Ensure the pytalloc changes are also in a way
> that makes it easy to rip out CObject if or when in the future I can
> get consensus on that point.
>
> Thanks!
>
> Andrew Bartlett
>
Hello.

Here is reworked and rebased patchset with all necessary changes. I've 
added one more module - samba.net - ported by Petr. The only missing 
thing are tests of samba.net because this library has no tests at all. I 
think that it would be better to merge this big patchset and add the 
tests later instead of postponing the merge because every rebase and 
check takes quite a lot of time.

Thank you and have a nice weekend.
Lumír
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0030-python-Port-the-samba.net-module-to-Python-3.patch
Type: text/x-patch
Size: 3987 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0030-python-Port-the-samba.net-module-to-Python-3-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0029-python-Remove-unused-import-PY3.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0029-python-Remove-unused-import-PY3-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0028-python-selftest-Add-possibility-to-run-old-Python-te.patch
Type: text/x-patch
Size: 3175 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0028-python-selftest-Add-possibility-to-run-old-Python-te-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0027-python-samba.gensec-Port-module-to-Python-3-compatib.patch
Type: text/x-patch
Size: 10918 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0027-python-samba.gensec-Port-module-to-Python-3-compatib-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0026-python-samba.gensec-Fix-error-handling-in-set_creden.patch
Type: text/x-patch
Size: 968 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0026-python-samba.gensec-Fix-error-handling-in-set_creden-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0025-python-selftests-Enable-samba.getopt-tests-execution.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0025-python-selftests-Enable-samba.getopt-tests-execution-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0024-python-samba.getopt-Port-module-to-Python-3-compatib.patch
Type: text/x-patch
Size: 1917 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0024-python-samba.getopt-Port-module-to-Python-3-compatib-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0023-python-samba.tests.core-Port-and-enable-core-tests-i.patch
Type: text/x-patch
Size: 2090 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0023-python-samba.tests.core-Port-and-enable-core-tests-i-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0022-python-samba.tests-Move-import-of-ported-modules-out.patch
Type: text/x-patch
Size: 978 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0022-python-samba.tests-Move-import-of-ported-modules-out-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0021-python-samba._ldb-Port-of-samba._ldb-to-Python-3-com.patch
Type: text/x-patch
Size: 3625 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0021-python-samba._ldb-Port-of-samba._ldb-to-Python-3-com-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0020-python-samba.tests.auth-Add-tests-for-samba.auth-mod.patch
Type: text/x-patch
Size: 2274 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0020-python-samba.tests.auth-Add-tests-for-samba.auth-mod-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0019-python-samba.auth-Port-samba.auth-to-Python-3-compat.patch
Type: text/x-patch
Size: 5433 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0019-python-samba.auth-Port-samba.auth-to-Python-3-compat-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0018-python-wscript_build-Build-some-DCE-RPC-modules-with.patch
Type: text/x-patch
Size: 6807 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0018-python-wscript_build-Build-some-DCE-RPC-modules-with-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0017-python-samba.dcerpc-Port-security-module-to-Python-3.patch
Type: text/x-patch
Size: 3628 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0017-python-samba.dcerpc-Port-security-module-to-Python-3-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0016-python-samba.tests.dcerpc.misc-Port-and-enable-tests.patch
Type: text/x-patch
Size: 2390 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0016-python-samba.tests.dcerpc.misc-Port-and-enable-tests-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0015-python-samba.dcerpc-Port-RPC-related-stuff-to-Python.patch
Type: text/x-patch
Size: 16261 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0015-python-samba.dcerpc-Port-RPC-related-stuff-to-Python-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0014-python-pidl-Port-Python-interface-generator.patch
Type: text/x-patch
Size: 17740 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0014-python-pidl-Port-Python-interface-generator-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0013-pytalloc-Add-new-function-pytalloc_PyCapsule_FromTal.patch
Type: text/x-patch
Size: 9193 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0013-pytalloc-Add-new-function-pytalloc_PyCapsule_FromTal-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0012-python-samba.tests-Enable-Python-3-tests-for-ported-.patch
Type: text/x-patch
Size: 2017 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0012-python-samba.tests-Enable-Python-3-tests-for-ported--0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0011-buildtools-Work-around-a-.-being-in-the-target-name-.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0011-buildtools-Work-around-a-.-being-in-the-target-name--0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-python-wscript_build-Build-some-modules-for-Python-3.patch
Type: text/x-patch
Size: 3337 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0010-python-wscript_build-Build-some-modules-for-Python-3-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-python-Make-top-level-samba-modules-Python-3-compati.patch
Type: text/x-patch
Size: 8362 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0009-python-Make-top-level-samba-modules-Python-3-compati-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-python-samba.tests.dcerpc-Move-Class-RawDCERPCTest-t.patch
Type: text/x-patch
Size: 72683 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0008-python-samba.tests.dcerpc-Move-Class-RawDCERPCTest-t-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-python-samba.tests.glue-Add-new-tests-for-samba._glu.patch
Type: text/x-patch
Size: 3409 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0007-python-samba.tests.glue-Add-new-tests-for-samba._glu-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-python-samba._glue-Port-samba._glue-module-to-Python.patch
Type: text/x-patch
Size: 3280 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0006-python-samba._glue-Port-samba._glue-module-to-Python-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-python-samba.tests.param-Add-missing-tests.patch
Type: text/x-patch
Size: 2687 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0005-python-samba.tests.param-Add-missing-tests-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-python-samba.param-Port-param-module-to-Python-3.patch
Type: text/x-patch
Size: 13651 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0004-python-samba.param-Port-param-module-to-Python-3-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-python-samba.tests.credentials-Python-3-compatible-t.patch
Type: text/x-patch
Size: 5662 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0003-python-samba.tests.credentials-Python-3-compatible-t-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-python-samba.credentials-Port-pycredentials.c-to-Pyt.patch
Type: text/x-patch
Size: 2899 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0002-python-samba.credentials-Port-pycredentials.c-to-Pyt-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-build-Require-Python-2.7.0-to-build-Samba-unless.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170217/71ea55c0/0001-build-Require-Python-2.7.0-to-build-Samba-unless-0001.bin>


More information about the samba-technical mailing list