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

Andrew Bartlett abartlet at samba.org
Tue Feb 21 22:10:00 UTC 2017

On Tue, 2017-02-21 at 11:08 +0100, Lumir Balhar wrote:
> Hello.
> I completely understand that there are several customers with Python
> 2.6 
> and we still have to support them.
> Patch 12 in the previous patchset [0] was designed to keep Python
> 2.6 
> compatibility by redefining PyCapsule_* functions with PyCObject 
> alternatives which is a simple solution without much impact on
> pytalloc. 
> Also, the whole codebase can be developed and maintained with
> PyCapsule 
> only which is better for clear code and future maintainability.
> Then, when we'll decide to drop Python 2.6 support we just need to 
> delete this macros/function from py3compat.h file and continue with 
> PyCapsule only.
> Or we can redesign the API using something like the proposed 
> pytalloc_GenericObject. However, given our currently limited use of 
> CObject, I think this would need more discussion about the intended 
> direction of this API before going to redesign it. CObject currently 
> works, and PyCapsule is the obvious replacement, so I believe a
> patchset 
> for porting to Python 3 should use PyCapsule.

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. 

> If you agree, I'll try to add the mentioned changes back to the 
> patchset, I'll remove version 2.7 check and I'll test it as far as I
> can 
> with Python 2.6.

The issue I had is that when build with --enable-developer on modern
GCC, it failed to compile because the macros conflicted with those
already provided by Python 2.7.  

Therefore and regardless, I would also like it to use PyCapsule
directly on Python 2.7.

> [0] https://lists.samba.org/archive/samba-technical/2017-
> January/118482.html

Thanks Lumír for all your hard work on this.  Hopefully we can make
progress soon.

Andrew Bartlett

More information about the samba-technical mailing list