diff --git a/autowrap/CodeGenerator.py b/autowrap/CodeGenerator.py index 50d9fd5..8ac6712 100644 --- a/autowrap/CodeGenerator.py +++ b/autowrap/CodeGenerator.py @@ -2133,11 +2133,11 @@ def create_std_cimports(self): code.add(stmt) self.top_level_code.append(code) - + # If numpy is enabled, inline the ArrayWrapper/ArrayView classes if self.include_numpy: self.inline_array_wrappers() - + return code def inline_array_wrappers(self): @@ -2175,8 +2175,10 @@ def inline_array_wrappers(self): """) # Add the wrapper code directly code.add(wrapper_code_str) - - self.top_level_code.append(code) + + # Add to top_level_pyx_code so ArrayWrappers go to pyx only, not pxd + # This avoids conflicts when the project already has ArrayWrapper definitions + self.top_level_pyx_code.append(code) def create_includes(self): code = Code()