[issue30257] _bsddb: else misleadingly indented

STINNER Victor report at bugs.python.org
Wed May 3 08:04:41 EDT 2017


New submission from STINNER Victor:

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.

----------
components: Extension Modules
messages: 292890
nosy: haypo
priority: normal
severity: normal
status: open
title: _bsddb: else misleadingly indented
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30257>
_______________________________________


More information about the Python-bugs-list mailing list