[Git][reproducible-builds/diffoscope][master] comparators.macho: Use `str.startswith(...)` over `str.index(...) == 0` to…

Chris Lamb gitlab at salsa.debian.org
Sun Oct 7 23:22:55 CEST 2018


Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
56f8215c by Chris Lamb at 2018-10-07T21:22:27Z
comparators.macho: Use `str.startswith(...)` over `str.index(...) == 0` to prevent a traceback if the filename cannot be found on the line. (Closes: #910540)

- - - - -


1 changed file:

- diffoscope/comparators/macho.py


Changes:

=====================================
diffoscope/comparators/macho.py
=====================================
@@ -44,7 +44,7 @@ class Otool(Command):
     def filter(self, line):
         # Strip filename
         prefix = '{}:'.format(self._path)
-        if line.decode('utf-8', 'ignore').index(prefix) == 0:
+        if line.decode('utf-8', 'ignore').startswith(prefix):
             return line[len(prefix):].strip()
         return line
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/56f8215cc1ebba04b6ca1e6430dc1420a8974750

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/56f8215cc1ebba04b6ca1e6430dc1420a8974750
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20181007/2b8bed30/attachment.html>


More information about the rb-commits mailing list