taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.54k stars 2.29k forks source link

Error when `from __future__ import annotations` #8555

Open evan0greenup opened 4 months ago

evan0greenup commented 4 months ago

Describe the bug

When add from __future__ import annotation in the beginning of the source file, it will raise error.

To Reproduce

Just add from __future__ import annotation in any of example source files, the error will be thrown.

Log/Screenshots

(Skip)

$ python my_sample_code.py
[Taichi] mode=release
[Taichi] version 0.6.29, llvm 10.0.0, commit b63f6663, linux, python 3.8.3
...

Additional comments

In the future of Python release, from __future__ import annotations would be defaulted enabled. To get inspiration on how to support this, pydantic https://docs.pydantic.dev/latest/ would be a great resource to learn and research.