One function

uri_to_iri in wbond/asn1crypto

The author described this change as Fix type issue parsing IRI with explicit port on Python 3. It counts as a record because the check below fails on the code as it stood at db9a86b53 and passes on 0ca5d03ac, with nothing else changed between the two runs.

Fix saved2016-03-29
Sharing licenceMIT · LICENSE
Change size+2 2

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

Converts an ASCII URI byte string into a unicode IRI :param value: An ASCII-encoded byte string of the URI :return: A unicode string of the IRI

The change

2929 if hostname:
3030 hostname = hostname.decode('idna')
3131 port = parsed.port
32- if port:
32+ if port and not isinstance(port, int_types):
3333 port = port.decode('ascii')
3434
3535 netloc = ''
4141 if hostname is not None:
4242 netloc += hostname
4343 if port is not None:
44- netloc += ':' + port
44+ netloc += ':' + str_cls(port)
4545
4646 path = _urlunquote(parsed.path, remap=['/'], preserve=True)
4747 query = _urlunquote(parsed.query, remap=['&', '='], preserve=True)

The check that tells the two apart

failpass·tests/test_x509.py::X509Tests::test_iri_with_port

Check file tests/test_x509.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 itdb9a86b532b6ffa8a6846d9ef7a56e0afdea0e82
Broken version dated2016-03-29
Moduleasn1crypto._iri
Units changeduri_to_iri
Fingerprint77623520335b5ace
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 wbond/asn1crypto