Title: Variable may be used before first being assigned to in Lib/
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mark.dickinson, vincele
Priority: normal Keywords: patch

Created on 2009-08-01 22:18 by vincele, last changed 2009-08-04 22:00 by mark.dickinson. This issue is now closed.

File name Uploaded Description Edit vincele, 2009-08-01 22:18 Patch to initialize the var
_grouping_intervals.patch mark.dickinson, 2009-08-02 16:09
Messages (4)
msg91173 - (view) Author: Vincent Legoll (vincele) Date: 2009-08-01 22:18
The last_interval variable could potentially be used before being first
assigned a value.
msg91186 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-08-02 16:09
So this can happen only if grouping is [0] (or an equivalent iterable).  
Since this is an invalid grouping, I think the appropriate response would 
be for _grouping_intervals([0]) to raise an exception (which is what it 
currently does as soon as you iterate over the result, though this is 
possibly not by design. :)

Vincent, does the attached patch (_grouping_intervals.patch, against py3k) 
silence the pylint warning?
msg91274 - (view) Author: Vincent Legoll (vincele) Date: 2009-08-04 21:31
Yes it does
msg91277 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-08-04 22:00
Thanks.  Committed in r74312 (trunk), r74313 (py3k).
Date User Action Args
2009-08-04 22:00:29mark.dickinsonsetstatus: open -> closed
resolution: fixed
messages: + msg91277

stage: resolved
2009-08-04 21:31:12vincelesetmessages: + msg91274
2009-08-02 16:09:29mark.dickinsonsetfiles: + _grouping_intervals.patch
nosy: + mark.dickinson
messages: + msg91186

2009-08-01 22:18:36vincelecreate