Commit aa2437b212 for bind

commit aa2437b2125801865c946f6d7738f97ffd420f96
Author: Michal Nowak <mnowak@isc.org>
Date:   Fri Oct 9 13:21:12 2026 +0000

    Pass zone file paths to dnspython without str()

    Since dnspython 2.9.0, dns.zone.from_file() and Zone.to_file() accept
    any os.PathLike; earlier versions mistook a path object for an open
    file, which is why these call sites converted their pathlib.Path
    arguments to strings.

    The zone analyzer's loader opened its file as ASCII before handing it
    over; dnspython reads the path as UTF-8, a superset, so the ASCII zone
    files it loads decode the same.

    Assisted-by: Claude:claude-opus-5-5

diff --git a/bin/tests/system/dnssec_py/tests_dnskey_malformed.py b/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
index 27b5f4c246..5eefefc78d 100644
--- a/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
+++ b/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
@@ -74,7 +74,7 @@ def bootstrap():
     zone.render()

     # read the rendered zone
-    zoneobj = dns.zone.from_file(str(zone.path_unsigned), origin="dnskey-malformed.")
+    zoneobj = dns.zone.from_file(zone.path_unsigned, origin="dnskey-malformed.")

     # sign the zone (including the malformed ZSKs) with KSK
     with zoneobj.writer() as txn:
@@ -101,7 +101,7 @@ def bootstrap():
         multiple_rrset.add(create_malformed_rr(rr, i))
     multiple_rrset.add(rr)

-    zoneobj.to_file(str(zone.path_signed))
+    zoneobj.to_file(zone.path_signed)

     root = configure_root([zone])
     ksk_key_b64 = base64.b64encode(ksk_dnskey.key).decode()
diff --git a/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py b/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py
index 1772bc6ba7..71035dde92 100644
--- a/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py
+++ b/bin/tests/system/dnssec_py/tests_rrsigs_extra_expired.py
@@ -33,8 +33,6 @@ def bootstrap():
     zone.add_keys()
     zone.render()

-    signed_path = str(zone.path_signed)
-
     # create valid but expired signatures
     expired_rdata = set()
     now = int(time.time())
@@ -42,19 +40,19 @@ def bootstrap():
     end = now - 10000
     for i in range(2):
         zone.sign(f"-s {start - i} -e {end - i}")
-        expired = dns.zone.from_file(signed_path, origin="rrsigs-extra-expired.")
+        expired = dns.zone.from_file(zone.path_signed, origin="rrsigs-extra-expired.")
         rdataset = expired.get_rdataset("a", "RRSIG", "A")
         expired_rdata.add(rdataset.pop())

     # sign zone with valid sigs
     zone.sign()
-    valid = dns.zone.from_file(signed_path, origin="rrsigs-extra-expired.")
+    valid = dns.zone.from_file(zone.path_signed, origin="rrsigs-extra-expired.")
     rdataset = valid.find_rdataset("a", "RRSIG", "A")

     # add the expired RRSIGs for a.rrsigs-extra-expired
     for rd in expired_rdata:
         rdataset.add(rd)
-    valid.to_file(signed_path)
+    valid.to_file(zone.path_signed)

     root = configure_root([zone])
     return {
diff --git a/bin/tests/system/isctest/asyncserver/__init__.py b/bin/tests/system/isctest/asyncserver/__init__.py
index 50bc49f647..b8b5540109 100644
--- a/bin/tests/system/isctest/asyncserver/__init__.py
+++ b/bin/tests/system/isctest/asyncserver/__init__.py
@@ -520,7 +520,7 @@ class AsyncDnsServer(_AsyncServer):
     def _load_zone_file_with_origin(
         self, zone_file_path: pathlib.Path
     ) -> dns.zone.Zone:
-        zone = dns.zone.from_file(str(zone_file_path), origin=None, relativize=False)
+        zone = dns.zone.from_file(zone_file_path, origin=None, relativize=False)
         if zone.origin != dns.name.root:
             error = "only the root zone may use $ORIGIN in the zone file; "
             error += "for every other zone, its origin is determined by "
@@ -532,7 +532,7 @@ class AsyncDnsServer(_AsyncServer):
         self, zone_file_path: pathlib.Path
     ) -> dns.zone.Zone:
         origin = zone_file_path.name.removesuffix(".signed").removesuffix(".db")
-        return dns.zone.from_file(str(zone_file_path), origin=origin, relativize=False)
+        return dns.zone.from_file(zone_file_path, origin=origin, relativize=False)

     def _abort_if_dname_found_unless_acknowledged(self, zone: dns.zone.Zone) -> None:
         if self._acknowledge_manual_dname_handling:
diff --git a/bin/tests/system/isctest/name.py b/bin/tests/system/isctest/name.py
index 6343dd5d2f..835c1edac6 100644
--- a/bin/tests/system/isctest/name.py
+++ b/bin/tests/system/isctest/name.py
@@ -54,9 +54,7 @@ class ZoneAnalyzer:

     @classmethod
     def read_path(cls, zpath, origin):
-        with open(zpath, encoding="ascii") as zf:
-            zonedb = dns.zone.from_file(zf, origin, relativize=False)
-        return cls(zonedb)
+        return cls(dns.zone.from_file(zpath, origin, relativize=False))

     def __init__(self, zone: dns.zone.Zone):
         self.zone = zone
diff --git a/bin/tests/system/nsec_synthesis/conftest.py b/bin/tests/system/nsec_synthesis/conftest.py
index c0b8018aec..b561665bb3 100644
--- a/bin/tests/system/nsec_synthesis/conftest.py
+++ b/bin/tests/system/nsec_synthesis/conftest.py
@@ -22,7 +22,7 @@ import isctest.zone


 def zone_key_tags(zone):
-    signed = dns.zone.from_file(str(zone.path_signed), zone.dname, relativize=False)
+    signed = dns.zone.from_file(zone.path_signed, zone.dname, relativize=False)
     dnskeys = signed.get_rdataset(zone.dname, dns.rdatatype.DNSKEY)
     assert dnskeys, zone.path_signed
     return {dns.dnssec.key_id(dnskey) for dnskey in dnskeys}
diff --git a/bin/tests/system/verify/tests_verify.py b/bin/tests/system/verify/tests_verify.py
index 61264ed5bb..9e703909d4 100644
--- a/bin/tests/system/verify/tests_verify.py
+++ b/bin/tests/system/verify/tests_verify.py
@@ -80,7 +80,7 @@ def bootstrap():
         zone.render()

         # read the rendered zone
-        zoneobj = dns.zone.from_file(str(zone.path_unsigned), origin=f"{name}.")
+        zoneobj = dns.zone.from_file(zone.path_unsigned, origin=f"{name}.")
         lifetime = 30 * 86400

         # sign the zone
@@ -120,7 +120,7 @@ def bootstrap():
                 txn.add(nsec3_rrset)
                 txn.add(nsec3_owner, 300, nsec3_sigdata)

-        zoneobj.to_file(str(zone.path_signed))
+        zoneobj.to_file(zone.path_signed)

         return zone