You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python output raises NameError on import for any parameter or return typed long (emitted as the undefined name long) #109
PythonGenerator.PythonTypeName (Coder/Languages/PythonGenerator.cs ~line 695) maps only int, string, bool, float, double and void. Every other type name is written through unchanged. The C, C++, Go and Rust type maps all translate long (to long long, int64 and i64), and C# accepts long natively. Python has no long. Parameter and return annotations are evaluated when the def runs, and no from __future__ import annotations is emitted, so the generated module fails as soon as it is imported.
This is distinct from #102, which covers annotations naming a class that is declared later.
Actual:def total(count: long) -> long:. python3 -c "import m" fails with NameError: name 'long' is not defined.
Expected:def total(count: int) -> int:.
Suggested fix
Add "long" => "int" to PythonTypeName. It is worth checking the other numeric names the other generators map (e.g. short, byte, decimal) at the same time. Add a case to PythonGeneratedSourceImportsTests that imports a module using long.
Activity
matt-edmondson commentedon Sep 27, 2026
Triage
NameError, so it is loud, and the fix is a one-line mapping.PythonGenerator.PythonTypeName(~695)short,byte,decimal,uint,ulongandcharagainst the other generators' type maps in the same PR.Generated by Claude Code