building '_bsddb' extension gcc -pthread -fPIC -fno-strict-aliasing -O0 -g -O0 -Wall -Wstrict-prototypes -I/usr/include -I. -IInclude -I./Include -I/usr/local/include -I/home/haypo/prog/python/2.7/Include -I/home/haypo/prog/python/2.7 -c /home/haypo/prog/python/2.7/Modules/_bsddb.c -o build/temp.linux-x86_64-2.7-pydebug/home/haypo/prog/python/2.7/Modules/_bsddb.o /home/haypo/prog/python/2.7/Modules/_bsddb.c: Dans la fonction « newDBObject »: /home/haypo/prog/python/2.7/Modules/_bsddb.c:936:5: attention : this « else » clause does not guard... [-Wmisleading-indentation] else ^~~~ /home/haypo/prog/python/2.7/Modules/_bsddb.c:938:9: note : ...this statement, but the latter is misleadingly indented as if it is guarded by the « else » self->moduleFlags.cursorSetReturnsNone = DEFAULT_CURSOR_SET_RETURNS_NONE; ^~~~ gcc -pthread -shared build/temp.linux-x86_64-2.7-pydebug/home/haypo/prog/python/2.7/Modules/_bsddb.o -L/usr/lib64 -L/usr/local/lib -Wl,-R/usr/lib64 -ldb-5.3 -o build/lib.linux-x86_64-2.7-pydebug/_bsddb.so I agree that the indentation is surprising and looks like a bug. if (self->myenvobj) self->moduleFlags = self->myenvobj->moduleFlags; else self->moduleFlags.getReturnsNone = DEFAULT_GET_RETURNS_NONE; self->moduleFlags.cursorSetReturnsNone = DEFAULT_CURSOR_SET_RETURNS_NONE; Attached PR only don't set cursorSetReturnsNone to DEFAULT_CURSOR_SET_RETURNS_NONE anymore if self->myenvobj is set.
The second line in the else block was added... 14 years ago (!) by this commit: commit 455d46f0d921337405ebd3a098c210f3614ae77c Author: Gregory P. Smith <greg@mad-scientist.com> Date: Wed Jul 9 04:45:59 2003 +0000 bsddb 4.1.6: * Extended DB & DBEnv set_get_returns_none functionality to take a "level" instead of a boolean flag. The boolean 0 and 1 values still have the same effect. A value of 2 extends the "return None instead of raising an exception" behaviour to the DBCursor set methods. This will become the default behaviour in pybsddb 4.2. * Fixed a typo in DBCursor.join_item method that made it crash instead of returning a value. Obviously nobody uses it. Wrote a test case for join and join_item.
It looks to me that the valid combinations of getReturnsNone and cursorSetReturnsNone flags are 00, 10 and 11. But this suspicious code allows to get 01. It looks as a bug to me.