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.7: from __future__ import annotations #2950

Closed
matkuki opened this issue May 8, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@matkuki
Copy link

commented May 8, 2019

Hi,

I'm on Windows 10, Python 3.7.1, Cython 0.29.7.

I have some pure python code that I wanted to compile that uses
from __future__ import annotations, but compiling it throws:

Error compiling Cython file:
------------------------------------------------------------
...
# -*- coding: utf-8 -*-

from __future__ import annotations
                      ^
------------------------------------------------------------

app.py:6:23: future feature annotations is not defined
Traceback (most recent call last):
  File "D:\app\compile_with_cython.py", line 59, in <module>
    main()
  File "D:\app\compile_with_cython.py", line 54, in main
    language_level=3,
  File "C:\Python37\lib\site-packages\Cython\Build\Dependencies.py", line 1097, in cythonize
    cythonize_one(*args)
  File "C:\Python37\lib\site-packages\Cython\Build\Dependencies.py", line 1220, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: app/app.py

It is used to type annotate some self method parameters that need to reference itself.
I'm guessing that this is a not yet supported feature of CPython 3.7? Is there a way to bypass this without removing the from __future__ import annotations code?

Matic

@matkuki matkuki changed the title PYthon 3.7: from __future__ import annotations Python 3.7: from __future__ import annotations May 8, 2019

@scoder

This comment has been minimized.

Copy link
Contributor

commented May 19, 2019

Duplicate of #2863.

@scoder scoder closed this May 19, 2019

@scoder scoder added the R: duplicate label May 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.