One function

Xeger in leapfrogonline/rstr

The author described this change as Fix issue #38: Resolve bug exceeding STAR_PLUS_LIMIT" (#39). It counts as a record because the check below fails on the code as it stood at d12a8151f and passes on 487b85766, with nothing else changed between the two runs.

Fix saved2025-02-17
Sharing licenceBSD-3-Clause · LICENSE.txt
Change size+2 0

What the code was meant to do, written into the code itself as a docstring

Inspired by the Java library Xeger: http://code.google.com/p/xeger/ This class adds functionality to Rstr allowing users to generate a semi-random string from a regular expression.

The change

7373
7474 def _handle_repeat(self, start_range: int, end_range: int, value: str) -> str:
7575 result = []
76+ warnings.warn(f"end_range > {STAR_PLUS_LIMIT}.")
7677 end_range = min((end_range, STAR_PLUS_LIMIT))
78+ start_range = min(start_range, end_range)
7779 times = self._random.randint(start_range, end_range)
7880 for i in range(times):
7981 result.append(''.join(self._handle_state(i) for i in value))

The check that tells the two apart

failpass·tests/test_xeger.py::TestXeger::test_handle_repeat_exceeds_limit

Check file tests/test_xeger.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itd12a8151f13e68cf3b190fcee3e839b3a87f958c
Broken version dated2023-11-16
Modulerstr.xeger
Units changedXeger
Fingerprintf39fa3805acc57a4
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in leapfrogonline/rstr