diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-08-04 21:57:18 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-08-04 21:57:18 (GMT) |
commit | bbffb25c69f748a8842bb16718d79b86ad16b867 (patch) | |
tree | 42f5e95b945d78c4663d0af2d69ad5544fc74971 /Lib/locale.py | |
parent | 61b96dc2fe814595651b6e1af394b34cb41fb485 (diff) | |
download | cpython-bbffb25c69f748a8842bb16718d79b86ad16b867.zip cpython-bbffb25c69f748a8842bb16718d79b86ad16b867.tar.gz cpython-bbffb25c69f748a8842bb16718d79b86ad16b867.tar.bz2 |
Merged revisions 74312 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74312 | mark.dickinson | 2009-08-04 22:56:04 +0100 (Tue, 04 Aug 2009) | 4 lines
Issue #6620: Slightly safer code for _grouping_intervals in the locale
module. Fixes a 'possible use before assignment' warning from pylint.
Thanks Vincent Legoll.
........
Diffstat (limited to 'Lib/locale.py')
-rw-r--r-- | Lib/locale.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index f6d174c..4ab3c6a 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -121,12 +121,15 @@ def localeconv(): # Iterate over grouping intervals def _grouping_intervals(grouping): + last_interval = None for interval in grouping: # if grouping is -1, we are done if interval == CHAR_MAX: return # 0: re-use last group ad infinitum if interval == 0: + if last_interval is None: + raise ValueError("invalid grouping") while True: yield last_interval yield interval |