diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-08-04 21:56:04 +0000 |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-08-04 21:56:04 +0000 |
commit | 4b4567347310031b2e28f26e7d8b4430722de2f9 (patch) | |
tree | 983a14832ab047555fe3d65c4a08e48ccefe430d /Lib/locale.py | |
parent | 4809c737d3d8b236d84e11ed24c26d1dba3a99a5 (diff) | |
download | cpython-git-4b4567347310031b2e28f26e7d8b4430722de2f9.tar.gz |
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 879725feb9..f0733999d2 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -114,12 +114,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 |