[PATCHES] Port ldb to Python 3

Petr Viktorin pviktori at redhat.com
Thu Jul 30 11:10:19 UTC 2015


On 07/30/2015 11:08 AM, Stefan Metzmacher wrote:
> Hi Petr,
> 
>> Thank you Andrew and Stefan for reviewing the patches for tdb!
>>
>>
>> These patches add support for Python 3 to the last of Samba's
>> stand-alone libraries, ldb.
>>
>> There are some general fixes (mainly refcounting) thrown in.
> 
> As you seem to understand the refcounting could you have a look at
> https://bugzilla.samba.org/show_bug.cgi?id=7902 ?
> We have a refcount problem in our pidl generated python bindings...

I'm on vaction next week, but I'll try to fit this bug in tomorrow.

>> Under Python 3, DNs, attribute names, filters, controls are always text
>> (unicode) strings, encoded to/from UTF-8 for storage. Attribute values
>> are byte strings.
> 
> Does that have any impact on all the other scripts we have e.g. samba-tool,
> source4/dsdb/tests/python/* and others?

Not until those are ported to Python 3.

>> When creating DNs and attribute values, both text and bytes are acepted.
>> This allows creating messages from homogeneous dicts (where values and
>> "dn" are all either text or bytes).
>>
>> Similarly to the tdb bindings, LDB Messages and MessageElements have a
>> .text attribute, which offers a text view on the contents: any value
>> retrieved from it will be decoded using UTF-8. The wrapper is
>> implemented in a new Python module.
>>
>>
>> -- Petr Viktorin
>>
>> From c65e8f315077a0a0fef3f9cf164850ce6d813951 Mon Sep 17 00:00:00 2001
>> From: Petr Viktorin <pviktori at redhat.com>
>> Date: Tue, 9 Jun 2015 10:31:22 +0200
>> Subject: [PATCH 2/9] ldb: Build for two Python versions at once
> 
> Shouldn't that be the last patch? I guess this will only
> work after all the other fixes.

Well, having this in first made it possible to work on the porting
patches. It doesn't break things, because you still need to configure
with --extrapython=python3 to enable this.

You can reorder the patches and apply this at the end; it doesn't
conflict with the others.

> Other than that I'm happy with the changes.

Thanks for reviewing!

-- 
Petr Viktorin



More information about the samba-technical mailing list