|
Could you add a test for this? |
|
I have added a test case to the punycode Test-suite. |
There was a problem hiding this comment.
Please also add a NEWS file. See https://devguide.python.org/committing/#what-s-new-and-news-entries for details.
| # Make sure punycode codec raises the right kind of exception | ||
| # when given invalid punycode to decode | ||
| def test_decode_exceptions(self): | ||
| for byt, exception in punycode_decode_exceptions: |
| if len(i)!=2: | ||
| print(repr(i)) | ||
|
|
||
| punycode_decode_exceptions = [ |
There was a problem hiding this comment.
I'd rename this to invalid_punycode_testcases.
| puny = puny.decode("ascii").encode("ascii") | ||
| self.assertEqual(uni, puny.decode("punycode")) | ||
|
|
||
| # Make sure punycode codec raises the right kind of exception |
There was a problem hiding this comment.
Style nit: We can drop this comment.
| # when given invalid punycode to decode | ||
| def test_decode_exceptions(self): | ||
| for byt, exception in punycode_decode_exceptions: | ||
| with self.assertRaises(exception): |
There was a problem hiding this comment.
We couls use self.subTest() to make test failure messages clearer.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
I removed the " needs backport to 3.6" label, the 3.6 branch no longer accept bugfixes (only security fixes are accepted): https://devguide.python.org/#status-of-python-branches |
|
@vikhegde Would you like to move this forward by implementing @berkerpeksag's suggestions? |
|
This pull request seems to have been abandoned, so I'm going to close it. It can reopened if the original author is interested in working on it again or a new pull request can be created to replace it. Thank you! |
A bug in the punycode codec raises an IndexError when we attempt to decode the string "xn--w&". The fix is straightforward and obvious one-liner. Bug number: bpo-30566
https://bugs.python.org/issue30566