Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-bracex for openSUSE:Factory checked in at 2026-08-20 16:16:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-bracex (Old) and /work/SRC/openSUSE:Factory/.python-bracex.new.1258 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-bracex" Thu Aug 20 16:16:33 2026 rev:9 rq:1372179 version:3.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-bracex/python-bracex.changes 2026-07-13 14:28:32.888404148 +0200 +++ /work/SRC/openSUSE:Factory/.python-bracex.new.1258/python-bracex.changes 2026-08-20 16:16:48.540462379 +0200 @@ -1,0 +2,7 @@ +Thu Aug 20 09:04:41 UTC 2026 - Dirk Müller <[email protected]> + +- update to 3.0.1: + * **FIX**: Fix case where character or number ranges could + throw an exception (@santhreal). + +------------------------------------------------------------------- Old: ---- bracex-3.0.tar.gz New: ---- bracex-3.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-bracex.spec ++++++ --- /var/tmp/diff_new_pack.N0Ykc2/_old 2026-08-20 16:16:49.292489019 +0200 +++ /var/tmp/diff_new_pack.N0Ykc2/_new 2026-08-20 16:16:49.294489089 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-bracex -Version: 3.0 +Version: 3.0.1 Release: 0 Summary: Bash style brace expander License: MIT ++++++ bracex-3.0.tar.gz -> bracex-3.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bracex-3.0/PKG-INFO new/bracex-3.0.1/PKG-INFO --- old/bracex-3.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/bracex-3.0.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: bracex -Version: 3.0 +Version: 3.0.1 Summary: Bash style brace expander. Project-URL: Homepage, https://github.com/facelessuser/bracex Author-email: Isaac Muse <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bracex-3.0/bracex/__init__.py new/bracex-3.0.1/bracex/__init__.py --- old/bracex-3.0/bracex/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/bracex-3.0.1/bracex/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -33,11 +33,23 @@ _alpha = [chr(x) if x != 0x5c else '' for x in range(ord('A'), ord('z') + 1)] _nalpha = list(reversed(_alpha)) -RE_INT_ITER = re.compile(r'(-?\d+)\.{2}(-?\d+)(?:\.{2}(-?\d+))?(?=\})') -RE_CHR_ITER = re.compile(r'([A-Za-z])\.{2}([A-Za-z])(?:\.{2}(-?\d+))?(?=\})') +RE_INT_ITER = re.compile(r'(-?((?:0(?=\d))*)\d+)\.{2}(-?((?:0(?=\d))*)\d+)(?:\.{2}-?(((?:0(?=\d))*)\d+))?(?=\})') +RE_CHR_ITER = re.compile(r'([A-Za-z])\.{2}([A-Za-z])(?:\.{2}-?(((?:0(?=\d))*)\d+))?(?=\})') DEFAULT_LIMIT = 1000 +MAX_NEG_INT_64 = -2 ** 63 +MAX_INT_64 = abs(MAX_NEG_INT_64 + 1) + + +def int64(string: str) -> int: + """Convert string to 64-bit integer.""" + + integer = int(string) + if integer < MAX_NEG_INT_64 or integer > MAX_INT_64: + raise ValueError('Value is larger than the signed 64-bit storage type') + return integer + class Sentinel(str): """A sentinel string value.""" @@ -402,19 +414,17 @@ We look for `{1..2[..inc]}` or `{a..z[..inc]}` (negative numbers are fine). """ + index = i.index try: m = i.match(RE_INT_ITER) if m: - return self.get_int_range(*m.groups()) + return self.get_int_range(m) m = i.match(RE_CHR_ITER) if m: - return self.get_char_range(*m.groups()) - except Exception: # pragma: no cover - # TODO: We really should never fail here, - # but if we do, assume the sequence range - # was invalid. This catch can probably - # be removed in the future with more testing. + return self.get_char_range(m) + except Exception: + i.rewind(i.index - index) pass return None, 0 @@ -425,50 +435,59 @@ for value in values: yield "{:0{pad}d}".format(value, pad=padding) if padding else str(value) - def get_int_range(self, start: str, end: str, increment: str | None = None) -> tuple[Iterator[str], int]: + def get_int_range(self, m: re.Match[str]) -> tuple[Iterator[str], int]: """Get an integer range between start and end and increments of increment.""" - first, last = int(start), int(end) - inc = int(increment) if increment is not None else 1 - max_length = max(len(start), len(end)) - - # Zero doesn't make sense as an incrementer - # but like bash, just assume one - if inc == 0: - inc = 1 - - if start[0] == '-': - start = start[1:] - - if end[0] == '-': - end = end[1:] - - if (len(start) > 1 and start[0] == '0') or (len(end) > 1 and end[0] == '0'): - padding = max_length - - else: - padding = 0 + # Capture zero padding extent and capture numerical values without padding and limited to 19 digits. + # 64-bit integers are no longer than 19 digits. + spad = m.start(2), m.end(2) + off = m.start(1) + start = m.group(1)[:spad[0] - off] + m.group(1)[spad[1] - off:spad[1] - off + 19] + + epad = m.start(4), m.end(4) + off = m.start(3) + end = m.group(3)[:epad[0] - off] + m.group(3)[epad[1] - off :epad[1] - off + 19] + + ipad = m.start(6), m.end(6) + off = m.start(5) + increment = m.group(5)[0:ipad[0] - off] + m.group(5)[ipad[1] - off:ipad[1] - off + 19] if m.group(5) else '1' + + # Ensure values are within 64 bit range. + first = int64(start) + last = int64(end) + inc = max(1, int64(increment)) + + spad_len = spad[1] - spad[0] + epad_len = epad[1] - epad[0] + padding = max(spad_len + len(start), epad_len + len(end)) if spad_len or epad_len else 0 if first < last: - count = math.ceil(abs(((last + 1) - first) / inc)) - r = range(first, last + 1, -inc if inc < 0 else inc) + span = abs(last - first + 1) + ainc = abs(inc) + count = math.ceil(span / ainc) if ainc <= span else 1 + r = range(first, last + 1, inc) else: - count = math.ceil(abs(((first + 1) - last) / inc)) - r = range(first, last - 1, inc if inc < 0 else -inc) + span = abs(first - last + 1) + ainc = abs(inc) + count = math.ceil(span / ainc) if ainc <= span else 1 + r = range(first, last - 1, -inc) return self.format_values(r, padding), count - def get_char_range(self, start: str, end: str, increment: str | None = None) -> tuple[Iterator[str], int]: + def get_char_range(self, m: re.Match[str]) -> tuple[Iterator[str], int]: """Get a range of alphabetic characters.""" - inc = int(increment) if increment else 1 - if inc < 0: - inc = -inc - - # Zero doesn't make sense as an incrementer - # but like bash, just assume one - if inc == 0: - inc = 1 + start = m.group(1) + end = m.group(2) + + # Capture zero padding extent and capture numerical values without padding and limited to 19 digits. + # 64-bit integers are no longer than 19 digits. + ipad = m.start(4), m.end(4) + off = m.start(3) + increment = m.group(3)[0:ipad[0] - off] + m.group(3)[ipad[1] - off:ipad[1] - off + 19] if m.group(3) else '1' + + # Ensure values are within 64 bit range. + inc = max(1, int64(increment)) inverse = start > end alpha = _nalpha if inverse else _alpha @@ -477,10 +496,14 @@ last = alpha.index(end) if first < last: - count = math.ceil(((last + 1) - first) / inc) - return itertools.islice(alpha, first, last + 1, inc), count - count = math.ceil(((first + 1) - last) / inc) - return itertools.islice(alpha, last, first + 1, inc), count + span = last - first + 1 + count = math.ceil(span / inc) if inc <= abs(span) else 1 + r = range(first, last + 1, inc) + else: + span = first - last + 1 + count = math.ceil(span / inc) if inc <= abs(span) else 1 + r = range(first, last - 1, -inc) + return (alpha[i] for i in r), count def expand_str(self, string: str) -> Iterator[str]: """Expand the string.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bracex-3.0/bracex/__meta__.py new/bracex-3.0.1/bracex/__meta__.py --- old/bracex-3.0/bracex/__meta__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/bracex-3.0.1/bracex/__meta__.py 2020-02-02 01:00:00.000000000 +0100 @@ -193,5 +193,5 @@ return Version(major, minor, micro, release, pre, post, dev) -__version_info__ = Version(3, 0, 0, "final") +__version_info__ = Version(3, 0, 1, "final") __version__ = __version_info__._get_canonical() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bracex-3.0/docs/src/markdown/about/changelog.md new/bracex-3.0.1/docs/src/markdown/about/changelog.md --- old/bracex-3.0/docs/src/markdown/about/changelog.md 2020-02-02 01:00:00.000000000 +0100 +++ new/bracex-3.0.1/docs/src/markdown/about/changelog.md 2020-02-02 01:00:00.000000000 +0100 @@ -1,5 +1,9 @@ # Changes +## 3.0.1 + +- **FIX**: Fix case where character or number ranges could throw an exception (@santhreal). + ## 3.0 - **BREAK**: If there are no expansions, `bracex` will not return an empty string by default in the list. This matches diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bracex-3.0/tests/brace-cases.txt new/bracex-3.0.1/tests/brace-cases.txt --- old/bracex-3.0/tests/brace-cases.txt 2020-02-02 01:00:00.000000000 +0100 +++ new/bracex-3.0.1/tests/brace-cases.txt 2020-02-02 01:00:00.000000000 +0100 @@ -198,3 +198,68 @@ # Open braces x{ x{{ +{-10..10..-2} +{-10..10..2} +{10..-10..-2} +{10..-10..2} +{2..8..2} +{2..8..-2} +{-2..-8..2} +{-2..-8..-2} +# Handle iterations past range +{a..z..26} +{z..z..26} +{a..z..-26} +{z..z..-26} +{a..z..26} +{z..z..26} +{0..24..26} +{24..0..26} +{0..24..-26} +{24..0..-26} +{0..24..26} +{-25..-1..26} +{-1..-25..-26} +{-12..12..-26} +{12..-12..-26} +# Test pass max iteration range. +{a..z..9223372036854775807} +{z..z..9223372036854775807} +{a..z..-9223372036854775807} +{z..z..-9223372036854775807} +{a..z..9223372036854775807} +{z..z..9223372036854775807} +{0..24..9223372036854775807} +{24..0..9223372036854775807} +{0..24..-9223372036854775807} +{24..0..-9223372036854775807} +{0..24..9223372036854775807} +{-25..-1..9223372036854775807} +{-1..-25..-9223372036854775807} +{-12..12..-9223372036854775807} +{12..-12..-9223372036854775807} +{a..z..000000000000000000000009223372036854775807} +{z..z..000000000000000000000009223372036854775807} +# Test fail past max iteration range. +{a..z..9223372036854775808} +{z..z..9223372036854775808} +{a..z..-9223372036854775808} +{z..z..-9223372036854775808} +{a..z..9223372036854775808} +{z..z..9223372036854775808} +{0..24..9223372036854775808} +{24..0..9223372036854775808} +{0..24..-9223372036854775808} +{24..0..-9223372036854775808} +{0..24..9223372036854775808} +{-25..-1..9223372036854775808} +{-1..-25..-9223372036854775808} +{-12..12..-9223372036854775808} +{12..-12..-9223372036854775808} +# Test Sequence failure +{{12..-12..-9223372036854775808},a} +# Test range limits +{9223372036854775805..9223372036854775807} +{9223372036854775807..9223372036854775808} +{-9223372036854775808..-9223372036854775805} +{-9223372036854775809..-9223372036854775807} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bracex-3.0/tests/brace-results.txt new/bracex-3.0.1/tests/brace-results.txt --- old/bracex-3.0/tests/brace-results.txt 2020-02-02 01:00:00.000000000 +0100 +++ new/bracex-3.0.1/tests/brace-results.txt 2020-02-02 01:00:00.000000000 +0100 @@ -1117,4 +1117,122 @@ [a] [b]><><><><x{ [x{]><><><><x{{ -[x{{]><><><>< \ No newline at end of file +[x{{]><><><><{-10..10..-2} +[-10] +[-8] +[-6] +[-4] +[-2] +[0] +[2] +[4] +[6] +[8] +[10]><><><><{-10..10..2} +[-10] +[-8] +[-6] +[-4] +[-2] +[0] +[2] +[4] +[6] +[8] +[10]><><><><{10..-10..-2} +[10] +[8] +[6] +[4] +[2] +[0] +[-2] +[-4] +[-6] +[-8] +[-10]><><><><{10..-10..2} +[10] +[8] +[6] +[4] +[2] +[0] +[-2] +[-4] +[-6] +[-8] +[-10]><><><><{2..8..2} +[2] +[4] +[6] +[8]><><><><{2..8..-2} +[2] +[4] +[6] +[8]><><><><{-2..-8..2} +[-2] +[-4] +[-6] +[-8]><><><><{-2..-8..-2} +[-2] +[-4] +[-6] +[-8]><><><><{a..z..26} +[a]><><><><{z..z..26} +[z]><><><><{a..z..-26} +[a]><><><><{z..z..-26} +[z]><><><><{a..z..26} +[a]><><><><{z..z..26} +[z]><><><><{0..24..26} +[0]><><><><{24..0..26} +[24]><><><><{0..24..-26} +[0]><><><><{24..0..-26} +[24]><><><><{0..24..26} +[0]><><><><{-25..-1..26} +[-25]><><><><{-1..-25..-26} +[-1]><><><><{-12..12..-26} +[-12]><><><><{12..-12..-26} +[12]><><><><{a..z..9223372036854775807} +[a]><><><><{z..z..9223372036854775807} +[z]><><><><{a..z..-9223372036854775807} +[a]><><><><{z..z..-9223372036854775807} +[z]><><><><{a..z..9223372036854775807} +[a]><><><><{z..z..9223372036854775807} +[z]><><><><{0..24..9223372036854775807} +[0]><><><><{24..0..9223372036854775807} +[24]><><><><{0..24..-9223372036854775807} +[0]><><><><{24..0..-9223372036854775807} +[24]><><><><{0..24..9223372036854775807} +[0]><><><><{-25..-1..9223372036854775807} +[-25]><><><><{-1..-25..-9223372036854775807} +[-1]><><><><{-12..12..-9223372036854775807} +[-12]><><><><{12..-12..-9223372036854775807} +[12]><><><><{a..z..000000000000000000000009223372036854775807} +[a]><><><><{z..z..000000000000000000000009223372036854775807} +[z]><><><><{a..z..9223372036854775808} +[{a..z..9223372036854775808}]><><><><{z..z..9223372036854775808} +[{z..z..9223372036854775808}]><><><><{a..z..-9223372036854775808} +[{a..z..-9223372036854775808}]><><><><{z..z..-9223372036854775808} +[{z..z..-9223372036854775808}]><><><><{a..z..9223372036854775808} +[{a..z..9223372036854775808}]><><><><{z..z..9223372036854775808} +[{z..z..9223372036854775808}]><><><><{0..24..9223372036854775808} +[{0..24..9223372036854775808}]><><><><{24..0..9223372036854775808} +[{24..0..9223372036854775808}]><><><><{0..24..-9223372036854775808} +[{0..24..-9223372036854775808}]><><><><{24..0..-9223372036854775808} +[{24..0..-9223372036854775808}]><><><><{0..24..9223372036854775808} +[{0..24..9223372036854775808}]><><><><{-25..-1..9223372036854775808} +[{-25..-1..9223372036854775808}]><><><><{-1..-25..-9223372036854775808} +[{-1..-25..-9223372036854775808}]><><><><{-12..12..-9223372036854775808} +[{-12..12..-9223372036854775808}]><><><><{12..-12..-9223372036854775808} +[{12..-12..-9223372036854775808}]><><><><{{12..-12..-9223372036854775808},a} +[{12..-12..-9223372036854775808}] +[a]><><><><{9223372036854775805..9223372036854775807} +[9223372036854775805] +[9223372036854775806] +[9223372036854775807]><><><><{9223372036854775807..9223372036854775808} +[{9223372036854775807..9223372036854775808}]><><><><{-9223372036854775808..-9223372036854775805} +[-9223372036854775808] +[-9223372036854775807] +[-9223372036854775806] +[-9223372036854775805]><><><><{-9223372036854775809..-9223372036854775807} +[{-9223372036854775809..-9223372036854775807}]><><><>< \ No newline at end of file
