# HG changeset patch # User Manuel Jacob # Date 2022-05-31 00:04:24 # Node ID e3143ab9dadbc91dca9b007bf75eafad9a034cd6 # Parent 33872fec41e7f23cc15032df775e840444a3ac26 zeroconf: constant-fold a `pycompat.ispy3` I’ve checked that both bytes and str gets passed as the `name` parameter, so the rest of the condition is still required. Because there aren’t really any tests for the extensions, I didn’t want to refactor it to pass a single type. diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py --- a/hgext/zeroconf/Zeroconf.py +++ b/hgext/zeroconf/Zeroconf.py @@ -292,7 +292,7 @@ class DNSQuestion(DNSEntry): """A DNS question entry""" def __init__(self, name, type, clazz): - if pycompat.ispy3 and isinstance(name, str): + if isinstance(name, str): name = name.encode('ascii') if not name.endswith(b".local."): raise NonLocalNameException(name)