Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10: required field "lineno" missing from alias #2061

Closed
tianon opened this issue May 10, 2021 · 3 comments · Fixed by #2066
Closed

Python 3.10: required field "lineno" missing from alias #2061

tianon opened this issue May 10, 2021 · 3 comments · Fixed by #2066
Labels

Comments

@tianon
Copy link
Member

tianon commented May 10, 2021

Python 3.10 has introduced a change that breaks Hy (feeling like a case of "This Is The Way" with Python pre-releases :trollface:).

It seems to be related to https://bugs.python.org/issue43798 (some potentially useful discussion in pytest-dev/pytest#8539).

Here's the full backtrace (on latest master; specifically e1150cf):

$ python --version
Python 3.10.0b1
$ hy
Traceback (most recent call last):
  File "/opt/hylang/hy/hy/compiler.py", line 1648, in compile_eval_and_compile
    hy_eval(new_expr + body,
  File "/opt/hylang/hy/hy/compiler.py", line 1977, in hy_eval
    eval(ast_compile(_ast, filename, "exec"),
  File "/opt/hylang/hy/hy/compiler.py", line 62, in ast_compile
    return compile(a, filename, mode, hy_ast_compile_flags)
TypeError: required field "lineno" missing from alias

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/hy", line 8, in <module>
    from hy.cmdline import hy_main
  File "/opt/hylang/hy/hy/__init__.py", line 14, in <module>
    hy.importer._inject_builtins()
  File "/opt/hylang/hy/hy/importer.py", line 178, in _inject_builtins
    core = importlib.import_module('hy.core')
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/hylang/hy/hy/core/__init__.py", line 1, in <module>
    from .shadow import *
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1017, in get_code
  File "/opt/hylang/hy/hy/importer.py", line 130, in _hy_source_to_code
    data = hy_compile(hy_tree, module)
  File "/opt/hylang/hy/hy/compiler.py", line 2066, in hy_compile
    stdlib_ast = compiler.compile(mkexpr("eval-and-compile", mkexpr("import", "hy")))
  File "/opt/hylang/hy/hy/compiler.py", line 379, in compile
    raise e
  File "/opt/hylang/hy/hy/compiler.py", line 370, in compile
    ret = self.compile_atom(tree)
  File "/opt/hylang/hy/hy/compiler.py", line 364, in compile_atom
    return Result() + _model_compilers[type(atom)](self, atom)
  File "/opt/hylang/hy/hy/compiler.py", line 1730, in compile_expression
    return Result() + build_method(
  File "/opt/hylang/hy/hy/compiler.py", line 1665, in compile_eval_and_compile
    raise HyEvalError(str(e), self.filename, body, self.source)
hy.errors.HyEvalError: 
  File "[hy.models.Expression([
  hy.models.Symbol('import'),
  hy.models.Symbol('hy')])]", line 1
    ;; Copyright 2021 the authors.
    ^----------------------------^
required field "lineno" missing from alias

(I'm testing with the Dockerfile here in the repo by changing python:3 to python:3.10-rc, but any way of getting a recent Python 3.10 pre-release should reproduce similarly.)

@Kodiologist
Copy link
Member

Unfortunately, Travis is still using 3.10.0a5 for 3.10, so it will be a while before we'll be able to test this regularly. Thanks for the heads-up.

@tianon
Copy link
Member Author

tianon commented May 10, 2021

Yeah, I figured that was the case, but wanted to make sure it was filed and on the radar (with a central place to track it). 👍 ❤️

(Any appetite for switching to GitHub Actions? 😅)

@Kodiologist
Copy link
Member

If you mean that GitHub Actions can be used for testing, in place of Travis, then I'm not aware of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants