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: a write-only property generates @level.setter with no getter, so defining the class raises NameError #113
PythonGenerator.GeneratePropertyDeclaration (Coder/Languages/PythonGenerator.cs:125-137) writes @{name}.setter whenever CanWrite is true. That decorator needs a name property object to already exist in the class body, and one only exists if the @property getter was written first, which happens only when CanRead is true. For a write-only property, the decorator refers to a name that was never defined.
Running it with python3 fails when the class is defined: NameError: name 'level' is not defined. The other targets all emit a valid write-only property: C# set { ... }, JavaScript set level(value), and a set_level function for C, C++, Go and Rust.
Suggested fix / acceptance criteria
When !CanRead, emit a setter-only property without the decorator form:
Priority: Medium. The generated Python fails loudly with NameError when the class is defined, so nothing wrong ships silently. It only affects write-only properties, which are uncommon.
Area / suggested owner:PythonGenerator.GeneratePropertyDeclaration
Duplicates / in progress: None found. No open PR references this issue.
Notes: Small, self-contained fix. The suggested property(fset=...) form is correct. Apply the same handling to static or class-level properties if the generator has a separate path for them.
Activity
matt-edmondson commentedon Sep 27, 2026
Triage
NameErrorwhen the class is defined, so nothing wrong ships silently. It only affects write-only properties, which are uncommon.PythonGenerator.GeneratePropertyDeclarationproperty(fset=...)form is correct. Apply the same handling to static or class-level properties if the generator has a separate path for them.Generated by Claude Code