Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Explicitly use floor division to please Python 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimgr committed Jul 3, 2014
1 parent 3483377 commit dccabcb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pymake/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _replacemakecontinuations(m):
start, end = m.span(1)
if start == -1:
return ' '
return ' '.rjust((end - start) / 2 + 1, '\\')
return ' '.rjust((end - start) // 2 + 1, '\\')

def itermakefilechars(d, offset, tokenlist, it, ignorecomments=False):
"""
Expand All @@ -166,10 +166,10 @@ def itermakefilechars(d, offset, tokenlist, it, ignorecomments=False):
# multiple backslashes before a hash are unescaped, halving their total number
if l % 2:
# found a comment
yield starttext + token[:(l - 1) / 2], None, None, None
yield starttext + token[:(l - 1) // 2], None, None, None
return
else:
yield starttext + token[-l / 2:], None, None, mend
yield starttext + token[-l // 2:], None, None, mend
elif token in tokenlist or (token[0] == '$' and '$' in tokenlist):
yield starttext, token, mstart, mend
else:
Expand Down Expand Up @@ -198,11 +198,11 @@ def flattenmakesyntax(d, offset):
elements.append(s[offset:mstart])
if (mend - mstart) % 2:
# even number of backslashes... it's a comment
elements.append(''.ljust((mend - mstart - 1) / 2, '\\'))
elements.append(''.ljust((mend - mstart - 1) // 2, '\\'))
return ''.join(elements)

# odd number of backslashes
elements.append(''.ljust((mend - mstart - 2) / 2, '\\') + '#')
elements.append(''.ljust((mend - mstart - 2) // 2, '\\') + '#')
offset = mend

elements.append(s[offset:])
Expand Down

0 comments on commit dccabcb

Please sign in to comment.