nonsensical TypeError from "-X jit -m compile --static"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with cinder_typed_prim_bug.py and reproduce the failure using the Docker command with -X jit -m compiler --static. Trace the compiler path from compiler/main.py for calls using static.double primitives and compare it with the working command. Done means the example runs successfully and prints the expected result without the TypeError.
Written by the indexing model from the issue text.
Description
good (no options):
$ docker run -v $PWD:/vol -it --rm ghcr.io/facebookincubator/cinder-runtime:cinder-3.8 vol/cinder_typed_prim_bug.py
done 0.57
bad (-X jit -m compile --static):
$ docker run -v $PWD:/vol -it --rm ghcr.io/facebookincubator/cinder-runtime:cinder-3.8 -X jit -m compiler --static vol/cinder_typed_prim_bug.py
Traceback (most recent call last):
File "/cinder/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/cinder/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/cinder/lib/python3.8/compiler/__main__.py", line 122, in <module>
exec(codeobj, d, d)
File "vol/cinder_typed_prim_bug.py", line 15, in __main__
main()
File "vol/cinder_typed_prim_bug.py", line 10, in main
c += foo(.4, .97)
TypeError: unsupported operand type(s) for +=: 'float' and 'function'
The compiler is acting as if the written code were c += foo rather than c += foo(.4, .97).
The problem goes away by removing -X jit, --static, or use of the double primitives.
cinder_typed_prim_bug.py
from __static__ import double
def foo(a: double, b: double) -> double:
return b - a
def main():
c = 0.
c += foo(.4, .97)
print('done', c)
if __name__ == '__main__':
main()
seen in cinder-3.8.6c2de94
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from facebookincubator/MetaPython
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
facebookincubator/MetaPython#147 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
facebookincubator/MetaPython#146 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
facebookincubator/MetaPython#145 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
facebookincubator/MetaPython#144 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
facebookincubator/MetaPython#129 · 2 comments ·
All issues in facebookincubator/MetaPython
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
StevenBlack/hosts#3256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
qualcomm/qai-appbuilder#275 ·