Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4b929e

Browse files
committed
no need to translate newlines in python code anymore
1 parent aeaa592 commit b4b929e

1 file changed

Lines changed: 0 additions & 15 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -344,21 +344,6 @@ def get_code(self, fullname):
344344
message = "a source path must exist to load {0}".format(fullname)
345345
raise ImportError(message)
346346
source = self.get_data(source_path)
347-
# Convert to universal newlines.
348-
line_endings = b'\n'
349-
for index, c in enumerate(source):
350-
if c == ord(b'\n'):
351-
break
352-
elif c == ord(b'\r'):
353-
line_endings = b'\r'
354-
try:
355-
if source[index+1] == ord(b'\n'):
356-
line_endings += b'\n'
357-
except IndexError:
358-
pass
359-
break
360-
if line_endings != b'\n':
361-
source = source.replace(line_endings, b'\n')
362347
return compile(source, source_path, 'exec', dont_inherit=True)
363348

364349
# Never use in implementing import! Imports code within the method.

0 commit comments

Comments
 (0)