D6511: py3: hack around inconsistency of type of name passed to DNSQuestion
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Jun 11 18:00:58 UTC 2019
pulkit created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
I don't like this patch but this is the easiest way I could fix it. There are
some callers which pass name which is bytes, some pass name which is str. I just
encode() that if that's str.
This does makes test-paths.t pass, but I am not confident whether the whole of
zeroconf will work on py3 or not.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6511
AFFECTED FILES
contrib/python3-whitelist
hgext/zeroconf/Zeroconf.py
CHANGE DETAILS
diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -89,6 +89,8 @@
import time
import traceback
+from mercurial import pycompat
+
__all__ = ["Zeroconf", "ServiceInfo", "ServiceBrowser"]
# hook for threads
@@ -270,6 +272,8 @@
"""A DNS question entry"""
def __init__(self, name, type, clazz):
+ if pycompat.ispy3 and isinstance(name, str):
+ name = name.encode('ascii')
if not name.endswith(".local."):
raise NonLocalNameException(name)
DNSEntry.__init__(self, name, type, clazz)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -517,6 +517,7 @@
test-pathconflicts-merge.t
test-pathconflicts-update.t
test-pathencode.py
+test-paths.t
test-pending.t
test-permissions.t
test-phabricator.t
To: pulkit, #hg-reviewers
Cc: mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list