Skip to content

Commit da6ffc3

Browse files
authored
Merge pull request #30 from sysprog21/fix-range
Fix Symbol.ranges unpacking
2 parents e1f15e3 + a5b6ecd commit da6ffc3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

guiconfig.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,23 +1844,23 @@ def _check_valid(dialog, entry, sym, s):
18441844
# Returns True if the string 's' is a well-formed value for 'sym'.
18451845
# Otherwise, pops up an error and returns False.
18461846

1847-
if sym.type not in (INT, HEX):
1847+
if sym.orig_type not in (INT, HEX):
18481848
# Anything goes for non-int/hex symbols
18491849
return True
18501850

1851-
base = 10 if sym.type == INT else 16
1851+
base = 10 if sym.orig_type == INT else 16
18521852
try:
18531853
int(s, base)
18541854
except ValueError:
18551855
messagebox.showerror(
18561856
"Bad value",
1857-
"'{}' is a malformed {} value".format(s, TYPE_TO_STR[sym.type]),
1857+
"'{}' is a malformed {} value".format(s, TYPE_TO_STR[sym.orig_type]),
18581858
parent=dialog,
18591859
)
18601860
entry.focus_set()
18611861
return False
18621862

1863-
for low_sym, high_sym, cond in sym.ranges:
1863+
for low_sym, high_sym, cond, _ in sym.ranges:
18641864
if expr_value(cond):
18651865
low_s = low_sym.str_value
18661866
high_s = high_sym.str_value
@@ -1883,8 +1883,8 @@ def _range_info(sym):
18831883
# Returns a string with information about the valid range for the symbol
18841884
# 'sym', or None if 'sym' doesn't have a range
18851885

1886-
if sym.type in (INT, HEX):
1887-
for low, high, cond in sym.ranges:
1886+
if sym.orig_type in (INT, HEX):
1887+
for low, high, cond, _ in sym.ranges:
18881888
if expr_value(cond):
18891889
return "Range: {}-{}".format(low.str_value, high.str_value)
18901890

menuconfig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,7 +4104,7 @@ def _check_valid(sym, s):
41044104
_error("'{}' is a malformed {} value".format(s, TYPE_TO_STR[sym.orig_type]))
41054105
return False
41064106

4107-
for low_sym, high_sym, cond in sym.ranges:
4107+
for low_sym, high_sym, cond, _ in sym.ranges:
41084108
if expr_value(cond):
41094109
low_s = low_sym.str_value
41104110
high_s = high_sym.str_value
@@ -4123,7 +4123,7 @@ def _range_info(sym):
41234123
# 'sym', or None if 'sym' doesn't have a range
41244124

41254125
if sym.orig_type in (INT, HEX):
4126-
for low, high, cond in sym.ranges:
4126+
for low, high, cond, _ in sym.ranges:
41274127
if expr_value(cond):
41284128
return "Range: {}-{}".format(low.str_value, high.str_value)
41294129

0 commit comments

Comments
 (0)