]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix invalid escape warning 266/head
authorNoa Resare <noa@resare.com>
Mon, 17 Jul 2017 11:34:23 +0000 (12:34 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Jul 2017 11:34:23 +0000 (12:34 +0100)
a literal string '\#' in python 3.6 causes a DeprecationWarning "invalid escape sequence" as there is no defined backslash escape that looks like that. This change changes the string to a raw string, which makes the intent clear. The text format for unknown RR types is defined in RFC3597 Section 5, and should indeed be the two ascii characters backslash (0x5c) followed by pound sign (0x23).

dns/rdata.py

index 5c6c34deac59a531a3d46d464fa2edd0f682cecd..89b78492b6f81dc65755ff5146000ed6e10f504d 100644 (file)
@@ -274,7 +274,7 @@ class GenericRdata(Rdata):
     @classmethod
     def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
         token = tok.get()
-        if not token.is_identifier() or token.value != '\#':
+        if not token.is_identifier() or token.value != r'\#':
             raise dns.exception.SyntaxError(
                 r'generic rdata does not start with \#')
         length = tok.get_int()