]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Optimize wiredata __getitem__.
authorBrian Wellington <bwelling@xbill.org>
Wed, 17 Jun 2020 23:08:20 +0000 (16:08 -0700)
committerBrian Wellington <bwelling@xbill.org>
Wed, 17 Jun 2020 23:08:20 +0000 (16:08 -0700)
When getting an item (not a slice), call bytes.__getitem__ directly
rather than creating a new bytes object.

dns/wiredata.py

index a3fab7348514d1c98d323506d0923c9aba2b5569..51f12fc3637309ce6caf6d3fedfa731e34f1b47d 100644 (file)
@@ -37,7 +37,7 @@ class WireData(bytes):
                         raise dns.exception.FormError
 
                 return WireData(super().__getitem__(key))
-            return self.unwrap()[key]
+            return super().__getitem__(key)
         except IndexError:
             raise dns.exception.FormError