From: Noa Resare Date: Mon, 17 Jul 2017 11:34:23 +0000 (+0100) Subject: Fix invalid escape warning X-Git-Tag: v1.16.0~21^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e01bb9fc2f4b1bebe010fb2359c07f6eca18824;p=thirdparty%2Fdnspython.git Fix invalid escape warning 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). --- diff --git a/dns/rdata.py b/dns/rdata.py index 5c6c34de..89b78492 100644 --- a/dns/rdata.py +++ b/dns/rdata.py @@ -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()