Re: Third batch of API cleanup for exception safety

2020-07-14 Thread David Bremner
David Bremner writes: > This is a continuation of > > id:20200704151805.3717715-1-da...@tethera.net > > and probably needs to be applied on top. > > There are two patches not fitting the pattern of "add test" or "add > try/catch to fix test". pushed this batch of patches to master. d _

Re: [PATCH 1/2] doc: replace use of environment variables with a generated config

2020-07-14 Thread Floris Bruynooghe
On Sat 11 Jul 2020 at 10:20 -0300, David Bremner wrote: > I don't love the use of exec, but it is getting unwieldy to pass It's already a config file written in Python which is a terrible sin. So no need to apologise, I think it makes sense in this context. > configuration options on the sphinx-

Re: [PATCH 2/2] doc: add new python bindings to main documentatation tree.

2020-07-14 Thread Floris Bruynooghe
Oh, this is very nice! I've been thinking for a while I should attempt this. Great to see it being done! On Sat 11 Jul 2020 at 10:20 -0300, David Bremner wrote: > A seperate conf.py and doc directory will be needed if someone wants > to build the bindings docs separately from notmuch. > --- >

Re: [PATCH] doc: set up for autoapi / readthedocs compatibility

2020-07-14 Thread Floris Bruynooghe
On Sun 12 Jul 2020 at 09:02 -0300, David Bremner wrote: > sphinx-autoapi seems nicer conceptually (it parses the docs rather > than importing them), TIL about sphinx-autoapi, agree it's nicer conceptually. > but it also generates a ton of warnings, so > leave the default as autodoc. > --- > > Yo

Re: [PATCH 1/2] doc: replace use of environment variables with a generated config

2020-07-14 Thread Floris Bruynooghe
On Sat 11 Jul 2020 at 17:00 +0300, Tomi Ollila wrote: > On Sat, Jul 11 2020, David Bremner wrote: > >> I don't love the use of exec, but it is getting unwieldy to pass >> configuration options on the sphinx-build command line, and I >> anticipate further use of conditionals. > > Perhaps less "opin

[PATCH 2/4] test: add known broken test for n_d_get_version on closed db

2020-07-14 Thread David Bremner
This should not crash, but it does currently. --- test/T562-lib-database.sh | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/T562-lib-database.sh b/test/T562-lib-database.sh index c869341a..b8fba7d6 100755 --- a/test/T562-lib-database.sh +++ b/test/T562-

[PATCH 1/4] test: regression tests for n_d_status_string and n_d_get_path

2020-07-14 Thread David Bremner
These do not crash on a closed database, and we want to keep it that way. Start a new file of tests as T560-lib-error was starting to get unwieldy. --- test/T562-lib-database.sh | 70 +++ 1 file changed, 70 insertions(+) create mode 100755 test/T562-lib-databa

[PATCH 4/4] lib/n_d_get_version: catch exceptions and clarify the API

2020-07-14 Thread David Bremner
notmuch_database_get_version previously returned 0 on some errors, but did not document this. Luckily 0 is not a valid database version. --- lib/database.cc | 19 ++- lib/notmuch.h | 3 +++ test/T562-lib-database.sh | 1 - 3 files changed, 21 insertions(+),

batch 5, API exception handling cleanup

2020-07-14 Thread David Bremner
This is a followup and extension to id:20200709001709.449217-1-da...@tethera.net Since that finished with message.cc, this one starts on database.cc There is one non-boring patch here, namely [PATCH 3/4] lib: move deallocation of memory from n_d_close to n_d_destroy It (of course) p

[PATCH 3/4] lib: move deallocation of memory from n_d_close to n_d_destroy

2020-07-14 Thread David Bremner
In order to mimic the "best effort" API of Xapian to provide information from a closed database when possible, do not destroy the Xapian database object too early. Because the pointer to a Xapian database is no longer nulled on close, introduce a flag to track whether the notmuch database is open