Happy new year. Pushed patches 1-4 of this series so far. Looking fine,
but ugh, the below seems like a rather ugly hack in a function that is
probably called quite often.

Isn't there a more pretty variant avoiding these sys.version_info checks
all over the place?

> @@ -200,9 +201,9 @@ def _str(value):
>  
>      C++ code expects strings to be well formatted and
>      unicode strings to have no null bytes."""
> -    if not isinstance(value, basestring):
> +    if not isinstance(value, basestring if sys.version_info[0] == 2 else 
> str):
>          raise TypeError("Expected str or unicode, got %s" % str(type(value)))
> -    if isinstance(value, unicode):
> +    if sys.version_info[0] == 3 or isinstance(value, unicode):
>          return value.encode('UTF-8')
>      return value

Attachment: pgpsZskLRluHs.pgp
Description: PGP signature

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to