From 8f13315389f10fc2db2532900b0c5d0d98c9488c Mon Sep 17 00:00:00 2001 From: David Pokora Date: Fri, 29 Mar 2019 20:27:27 -0400 Subject: [PATCH] Updated line number calculation to use splitlines() instead of split('\n'). --- slither/core/source_mapping/source_mapping.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slither/core/source_mapping/source_mapping.py b/slither/core/source_mapping/source_mapping.py index 2a0ffa6a65..c4df7ff249 100644 --- a/slither/core/source_mapping/source_mapping.py +++ b/slither/core/source_mapping/source_mapping.py @@ -19,12 +19,12 @@ def _compute_line(source_code, start, length): Not done in an efficient way """ total_length = len(source_code) - source_code = source_code.split('\n') + source_code = source_code.splitlines(True) counter = 0 i = 0 lines = [] while counter < total_length: - counter += len(source_code[i]) +1 + counter += len(source_code[i]) i = i+1 if counter > start: lines.append(i)