Re: [PATCH v2 6/7] bindings/python-cffi: allow reopening a database

Subject: Re: [PATCH v2 6/7] bindings/python-cffi: allow reopening a database

Date: Sat, 09 Aug 2025 07:38:22 -0300

To: Anton Khirnov, notmuch@notmuchmail.org

Cc:

From: David Bremner


Anton Khirnov <anton@khirnov.net> writes:

>  
> +    def reopen(self, mode=None):
> +        """Reopen an opened notmuch database.
> +
> +        This is primarily useful to recover from OperationInvalidatedError.
> +        """

The mode argument needs to be documented somewhere.


> +        if isinstance(mode, str):
> +            mode = self.STR_MODE_MAP[mode]
> +        else:
> +            mode = mode or self.mode
> +        self.mode = mode

I see you are just copying what is done in the existing __init__ method,
but I wonder if this isn't a bit fragile. If the user passes the wrong
string, they will get a mysterious exception about the dictionary.

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: