##// END OF EJS Templates
stringutil: try to avoid running `splitlines()` only to get first line...
Martin von Zweigbergk -
r49894:75794847 default
parent child Browse files
Show More
@@ -687,6 +687,10 b' def isauthorwellformed(author):'
687
687
688 def firstline(text):
688 def firstline(text):
689 """Return the first line of the input"""
689 """Return the first line of the input"""
690 # Try to avoid running splitlines() on the whole string
691 i = text.find(b'\n')
692 if i != -1:
693 text = text[:i]
690 try:
694 try:
691 return text.splitlines()[0]
695 return text.splitlines()[0]
692 except IndexError:
696 except IndexError:
General Comments 0
You need to be logged in to leave comments. Login now