mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-17 06:20:27 +00:00
Python3: mark bytes explicitly
This commit is contained in:
parent
9fed380097
commit
033f9fbdb3
2 changed files with 5 additions and 5 deletions
|
|
@ -108,7 +108,7 @@ class IfConfig (object):
|
|||
# 80kB buffer should be enough for most boxen
|
||||
max_bufsize = bufsize * 10
|
||||
while True:
|
||||
buf = array.array('c', '\0' * bufsize)
|
||||
buf = array.array('b', b'\0' * bufsize)
|
||||
ifreq = struct.pack("iP", buf.buffer_info()[1], buf.buffer_info()[0])
|
||||
try:
|
||||
result = self._ioctl(self.SIOCGIFCONF, ifreq)
|
||||
|
|
@ -127,7 +127,7 @@ class IfConfig (object):
|
|||
while i < size:
|
||||
ifconf = data[i:i+self.ifr_size]
|
||||
name = struct.unpack("16s%ds" % (self.ifr_size-16), ifconf)[0]
|
||||
name = name.split('\0', 1)[0]
|
||||
name = name.split(b'\0', 1)[0]
|
||||
if name:
|
||||
if flags and not (self.getFlags(name) & flags):
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -169,9 +169,9 @@ class TestStrFormat (unittest.TestCase):
|
|||
|
||||
def test_ascii_safe (self):
|
||||
ascii_safe = linkcheck.strformat.ascii_safe
|
||||
self.assertEqual(ascii_safe("a"), "a")
|
||||
self.assertEqual(ascii_safe(u"a"), "a")
|
||||
self.assertEqual(ascii_safe(u"ä"), "")
|
||||
self.assertEqual(ascii_safe("a"), b"a")
|
||||
self.assertEqual(ascii_safe(u"a"), b"a")
|
||||
self.assertEqual(ascii_safe(u"ä"), b"")
|
||||
|
||||
def test_strip_control_chars(self):
|
||||
strip = linkcheck.strformat.strip_control_chars
|
||||
|
|
|
|||
Loading…
Reference in a new issue