Skip to content

Commit 71acc21

Browse files
committed
Fix scripts/gdextension_cython_preprocessor.py complaining about # godot_extension: generate_module_code() if it is placed after class definition
1 parent 4b2c3b1 commit 71acc21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/gdextension_cython_preprocessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def extract_classes_from_code(raw_code_lines: list[str]) -> ModuleDef:
262262
current_class.inject_code_at_line = i
263263

264264
elif pragma == INJECT_MODULE_CODE_PRAGMA:
265-
if current_class is not None:
265+
if not line.startswith("#"): # Detect unexpected indentation
266266
raise RuntimeError(
267267
f"Line {i + 1}: `# godot_extension: {pragma}` must be at module level (i.e. not within class/function definition)"
268268
)

0 commit comments

Comments
 (0)