One function

RstrBase in leapfrogonline/rstr

The author described this change as Fix a bug where setting end_range but not start_range would fail. It counts as a record because the check below fails on the code as it stood at b2253a2bc and passes on a7951e352, with nothing else changed between the two runs.

Fix saved2021-09-18
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

Create random strings from a variety of alphabets. The alphabets for printable(), uppercase(), lowercase(), digits(), and punctuation() are equivalent to the constants by those same names in the standard library string module. nondigits() uses an alphabet of string.letters + string.punctuation nonletters() uses an alphabet of string.digits + string.punctuation nonwhitespace() uses an alphabet of string.printable.strip() normal() uses an alphabet of string.letters + string.digits + ' ' (the space character) postalsafe() is based on USPS Publication 28 - Postal Addressing Standards: http://pe.usps.com/text/pub28/pub28c2.html The characters allowed in postal addresses are letters and digits, periods, slashes, the pound sign, and the hyphen. urlsafe() uses an alphabet of unreserved characters safe for use in URLs. From section 2.3 of RFC 3986: "Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde. domainsafe() uses an alphabet of characters allowed in hostnames, and consequently, in internet domains: letters, digits, and the hyphen.

The change

8686 start_range, end_range = (1, 10)
8787 else:
8888 k = start_range
89+ elif start_range is None:
90+ start_range = 1
8991
9092 if end_range:
9193 k = self._random.randint(start_range, end_range)

The check that tells the two apart

failpass·rstr/tests/test_rstr.py::TestRstr::test_end_range_no_start_range

Check file rstr/tests/test_rstr.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 itb2253a2bc900df3079498bbc10ff0e33f608347a
Broken version dated2021-08-01
Modulerstr.rstr_base
Units changedRstrBase
Fingerprint47bdc35269add804
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