Closed Bug 1552658 Opened 6 months ago Closed 6 months ago

Fix to make prepare_tlds.py run on Python 3

Categories

(Core :: Networking: DNS, enhancement, P3)

66 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: arpit73, Assigned: nimbus2020b, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [necko-triaged])

Attachments

(1 file)

47 bytes, text/x-phabricator-request
Details | Review

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

Type: defect → enhancement
Component: Untriaged → Networking: DNS
Product: Firefox → Core

prepare_tlds.py curently works fine with python 2.7, when using Python 3.6 the program crashes when it encounters accented characters in the public suffix list. I observed this with the 'aéroport' word. This can be fixed in Python 3 by modifying the following line of code:
https://searchfox.org/mozilla-central/source/netwerk/dns/prepare_tlds.py#51
Changing the line to

return encodings.idna.ToASCII(label).decode("utf-8")

by adding .decode("utf-8") at the end makes it run fine with Python 3. If the build system uses Python 2 then this change would make it easy to migrate to Python 3.

To test I ran with both versions of python and they produce the same C++ array as result.

Thanks for the report. I'll mark this as a good-first-bug for now, since you so nicely provided a fix.
If you want to submit the patch please do so: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch

Otherwise we'll wait for a contributor to get involved.

Mentor: valentin.gosu
Keywords: good-first-bug
Priority: -- → P3
Whiteboard: [necko-triaged]

I've solved my share of good-first bugs for Firefox before. I'd be happy to see someone else take this up.
If there is no activity in the following weeks, I will submit a patch :)

That's great! Thanks for letting us know.

Blocks: buildpython3
Summary: Fix to make prepare_tlds.py on Python 3 → Fix to make prepare_tlds.py run on Python 3
Attached file Bug 1552658 solved

Added python 3 support for prepare_tlds.py

Status: UNCONFIRMED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Assignee: nobody → nimbus2020b
You need to log in before you can comment on or make changes to this bug.