[PATCH] python: fix get_property error when property doesn't exist

David Bremner david at tethera.net
Fri Feb 1 05:45:33 PST 2019


Vincent A <dev at indigo.re> writes:

> In Python bindings, Message.get_property fails with an AttributeError 
> when trying to fetch a property that doesn't exist.

> -        return value.value.decode('utf-8') if value is not None else None
> +        if value is None or value.value is None:
> +            return None
> +        return value.value.decode('utf-8')
>  

Should we be throwing an appropriate exception rather than returning
None? That seems more pythonic to me. In either case we should document
the error handling.

d


More information about the notmuch mailing list