Patchwork D6510: py3: add r'' prefixes and do ('%d' % int) instead of str(int)

login
register
mail settings
Submitter phabricator
Date June 30, 2019, 10:57 a.m.
Message ID <c808b33e40beb9a2c2e9206b913299b0@localhost.localdomain>
Download mbox | patch
Permalink /patch/40735/
State Not Applicable
Headers show

Comments

phabricator - June 30, 2019, 10:57 a.m.
Closed by commit rHG683aeef12830: py3: add r&#039;&#039; prefixes and do (&#039;%d&#039; % int) instead of str(int) (authored by pulkit).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6510?vs=15445&id=15724

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6510/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6510

AFFECTED FILES
  hgext/zeroconf/Zeroconf.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -535,7 +535,7 @@ 
 
     def readString(self, len):
         """Reads a string of a given length from the packet"""
-        format = '!' + str(len) + 's'
+        format = '!%ds' % len
         length = struct.calcsize(format)
         info = struct.unpack(format,
                              self.data[self.offset:self.offset + length])
@@ -613,7 +613,7 @@ 
 
     def readName(self):
         """Reads a domain name from the packet"""
-        result = ''
+        result = r''
         off = self.offset
         next = -1
         first = off
@@ -625,7 +625,7 @@ 
                 break
             t = len & 0xC0
             if t == 0x00:
-                result = ''.join((result, self.readUTF(off, len) + '.'))
+                result = r''.join((result, self.readUTF(off, len) + r'.'))
                 off += len
             elif t == 0xC0:
                 if next < 0: