Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r2152:161ecb5a7186
Date: 2015-06-01 18:23 +0200
http://bitbucket.org/cffi/cffi/changeset/161ecb5a7186/

Log:    Issue #205: Python 2.6 compat: "import" accept files that don't
        finish with a newline, but "compile()" doesn't.

diff --git a/cffi/setuptools_ext.py b/cffi/setuptools_ext.py
--- a/cffi/setuptools_ext.py
+++ b/cffi/setuptools_ext.py
@@ -18,7 +18,9 @@
     # __init__.py files may already try to import the file that
     # we are generating.
     with open(filename) as f:
-        code = compile(f.read(), filename, 'exec')
+        src = f.read()
+        src += '\n'      # Python 2.6 compatibility
+        code = compile(src, filename, 'exec')
     exec(code, glob, glob)
 
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to