Skip to content

Commit 8ee787e

Browse files
committed
Fix bug in pyi generation
1 parent 8b6706b commit 8ee787e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

codegen/pyi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn generator(type_data: &[PythonBindType]) -> io::Result<()> {
125125
}
126126
RustType::Option(InnerOptionType::Custom, type_name)
127127
| RustType::Option(InnerOptionType::Box, type_name) => {
128-
python_types.push(format!("Optional[{type_name}]"));
128+
write_fmt!(file, " {variable_name}: Optional[{type_name}]");
129129

130130
let python_type = if type_name == "Float" {
131131
"Float | float"
@@ -134,8 +134,8 @@ pub fn generator(type_data: &[PythonBindType]) -> io::Result<()> {
134134
} else {
135135
type_name.as_str()
136136
};
137-
138-
write_fmt!(file, " {variable_name}: Optional[{python_type}]");
137+
138+
python_types.push(format!("Optional[{python_type}]"));
139139
}
140140
RustType::Box(inner_type) => {
141141
python_types.push(inner_type.to_string());

0 commit comments

Comments
 (0)