[issue28149] Incorrect indentation under “else” in _bsddb.c

2017-05-03 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed
superseder:  -> _bsddb: else misleadingly indented

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28149] Incorrect indentation under “else” in _bsddb.c

2016-09-14 Thread Martin Panter

New submission from Martin Panter:

Compiling Python 2.7 gives:

/home/proj/python/cpython/Modules/_bsddb.c: In function ‘newDBObject’:
/home/proj/python/cpython/Modules/_bsddb.c:936:5: warning: this ‘else’ clause 
does not guard... [-Wmisleading-indentation]
 else
 ^~~~
/home/proj/python/cpython/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;
 ^~~~

The code in question was changed a long time ago in revision defa1d825b08:

 if (self->myenvobj)
-self->getReturnsNone = self->myenvobj->getReturnsNone;
+self->moduleFlags = self->myenvobj->moduleFlags;
 else
-self->getReturnsNone = GET_RETURNS_NONE_DEFAULT;
+self->moduleFlags.getReturnsNone = DEFAULT_GET_RETURNS_NONE;
+self->moduleFlags.cursorSetReturnsNone = 
DEFAULT_CURSOR_SET_RETURNS_NONE;

It looks like the solution is to group both statements with braces, but I don’t 
know this module, so I can’t be sure, and I don’t know how to test it.

--
components: Extension Modules
messages: 276422
nosy: gregory.p.smith, martin.panter
priority: normal
severity: normal
stage: test needed
status: open
title: Incorrect indentation under “else” in _bsddb.c
type: compile error
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com