[python-ldap] syncrepl fix for pyasn1 >= 0.3

Michael Ströder michael at stroeder.com
Wed Nov 8 06:19:07 EST 2017

Ilya Etingof wrote:
> Would it be possible to bump pyasn1 version requirement at python-ldap
> to 0.3+ and remove all these `if xxx is None` comparisons? I guess not
> because that might be against versioning policies.

Well, there is no versioning policy.
Therefore we can define whatever is most suitable. ;-)

Possible solution:
- set strict requirement for python-ldap 2.4.x to pyasn1 < 0.3.x
- set requirement for an upcoming python-ldap 2.5.x to pyasn1 >= 0.3.x

Therefore if we don't find another solution I could cut a 2.4.46 release
now containing recent minor changes and immediately start with 2.5.x
adding a modification of your patches. All people installing/upgrading
from PyPI would be happy with python-ldap 2.5.x and pyasn1 0.3.x.

Not sure about people installing from OS distro packages though. I don't
have an overview whether there's already a distro release with
incompatible combination.

@Ilya: Can you oversee which distros already ship with pyasn1 0.3.x?

> To my understanding the `is` operator can't be overloaded because it is
> a memory address comparison.


> May be we could inject the `NoValue` class along with the `noValue`
> singleton object into  pyasn1 from the python-ldap code at import time:
>     from pyasn1.type import univ
>     try:
>         univ.noValue
>     except AttributeError:
>         univ.NoValue = univ.noValue = None
> What would let us remove all these nasty `if xxx is None or  ... `
> pieces from python-ldap code.
> Would that work?

I thought of something like this. But what would the if condition look
like? With the above this if-expression would not work:

  if not cookie.hasValue():

Or am I missing something?

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3829 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20171108/d301446f/attachment.bin>

More information about the python-ldap mailing list