diff --git a/.travis.yml b/.travis.yml index 7a10e06..0d2ef6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,12 @@ python: - "3.4" - "3.5" - "3.6" + - "3.7-dev" - pypy - pypy3 +matrix: + allow_failures: + - python: "3.7-dev" install: - pip install -r requirements-travis.txt - pip install -e . diff --git a/hy/_compat.py b/hy/_compat.py index dc5a7d6..a22bb13 100644 --- a/hy/_compat.py +++ b/hy/_compat.py @@ -23,6 +23,7 @@ import sys PY3 = sys.version_info[0] >= 3 PY35 = sys.version_info >= (3, 5) PY36 = sys.version_info >= (3, 6) +PY37 = sys.version_info >= (3, 7) str_type = str if PY3 else unicode # NOQA bytes_type = bytes if PY3 else str # NOQA diff --git a/hy/importer.py b/hy/importer.py index 58b484a..450de27 100644 --- a/hy/importer.py +++ b/hy/importer.py @@ -18,7 +18,7 @@ import inspect import os import __future__ -from hy._compat import PY3, MAGIC, builtins, long_type, wr_long +from hy._compat import PY3, PY37, MAGIC, builtins, long_type, wr_long from hy._compat import string_types @@ -220,6 +220,12 @@ def write_code_as_pyc(fname, code): with builtins.open(cfile, 'wb') as fc: fc.write(MAGIC) + if PY37: + # With PEP 552, the header structure has a new flags field + # that we need to fill in. All zeros preserve the legacy + # behaviour, but should we implement reproducible builds, + # this is where we'd add the information. + wr_long(fc, 0) wr_long(fc, timestamp) if PY3: wr_long(fc, st.st_size)