diff --git a/vyper/cli/vyper_compile.py b/vyper/cli/vyper_compile.py index 446b37e75a..bf223be902 100755 --- a/vyper/cli/vyper_compile.py +++ b/vyper/cli/vyper_compile.py @@ -218,7 +218,9 @@ def compile_files( except ValueError: file_str = file_path.as_posix() with file_path.open() as fh: - contract_sources[file_str] = fh.read() + # trailing newline fixes python parsing bug when source ends in a comment + # https://bugs.python.org/issue35107 + contract_sources[file_str] = fh.read() + "\n" show_version = False if "combined_json" in output_formats: diff --git a/vyper/compiler/__init__.py b/vyper/compiler/__init__.py index 049ced3526..8687309801 100644 --- a/vyper/compiler/__init__.py +++ b/vyper/compiler/__init__.py @@ -85,9 +85,7 @@ def compile_codes( out: OrderedDict = OrderedDict() for source_id, contract_name in enumerate(sorted(contract_sources), start=initial_id): - # trailing newline fixes python parsing bug when source ends in a comment - # https://bugs.python.org/issue35107 - source_code = f"{contract_sources[contract_name]}\n" + source_code = contract_sources[contract_name] interfaces: Any = interface_codes if ( isinstance(interfaces, dict)