Closed elliotwutingfeng closed 1 year ago
Hmm it seems rather unimpressive that mypy
does not spot that str.join(list[bytes])
will fail.
There is a wider issue here. The codec decoder also doesn't work properly. The existing tests in test_idna_codec.py
should be noticing both of these issues, except that, even after import idna.codec
, codecs.lookup('idna')
is still returning the Python standard library codec instead of the one from this library, so the tests are just testing the Python codec instead of this library's one.
I noted here that the codec implementation appears to be untested, broken, and likely unused. https://github.com/kjd/idna/issues/134
I see. I think further discussion would be needed before attempting to fix this.
@elliotwutingfeng I think your fix was fine, I have incorporated it into my PR #145 which also fixes the other issues.
Thanks! Yes, it is better to consolidate all the fixes into one PR.
Current implementation of _buffer_encode() has the wrong type signature (expected bytes but got str). It also attempts to perform a str.join() on list[bytes].
Fixes #138