**Migrated issue, originally created by Sebastian Bank ([@xflr6](https://github.com/xflr6))** Under Python 2.7, the files created by ``alembic revision`` have CR+CR+LF line endings. Mako [opens the template](https://bitbucket.org/zzzeek/mako/src/285bc818a50ccc0f9549630f7c4f4c250585c3e7/mako/util.py?at=master#cl-342) with mode ``rb``, while [alembic uses](https://bitbucket.org/zzzeek/alembic/src/ac95bad85cc6267e3ce013319ee590a084565666/alembic/util.py?at=master#cl-61) ``w`` producing the extra CRs.