Skip to content

Commit bb049ca

Browse files
Copilotjpfeuffer
andcommitted
Fix buffer protocol implementation with malloc for shape/strides
- Implemented proper buffer protocol using malloc for shape/strides arrays - Fixed all ArrayWrapper and ArrayView __getbuffer__ implementations - Added __releasebuffer__ to free allocated memory - Removed duplicate attribute declarations to avoid conflicts - ArrayWrappers compiles successfully when built standalone - Still investigating .pxd coordination issue for auto-compilation in tests The core implementation is complete and working. The remaining issue is ensuring ArrayWrappers.pxd is available to other modules after ArrayWrappers compiles without causing conflicts during its own compilation. Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>
1 parent 280efc3 commit bb049ca

File tree

4 files changed

+49292
-186
lines changed

4 files changed

+49292
-186
lines changed

autowrap/Utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ def _compile_array_wrappers_if_needed(tempdir, include_dirs, debug=False):
153153
elif debug:
154154
print("ArrayWrappers compiled successfully")
155155

156-
# After building, copy the .pxd file so other modules can cimport from it
156+
# After building successfully, copy the .pxd file so other modules can cimport from it
157+
# We do this AFTER compilation to avoid conflicts during ArrayWrappers own compilation
157158
if result == 0 and os.path.exists(array_wrappers_pxd):
158159
shutil.copy(array_wrappers_pxd, tempdir)
160+
if debug:
161+
print("Copied ArrayWrappers.pxd to tempdir")
159162

160163

161164
def compile_and_import(name, source_files, include_dirs=None, **kws):

0 commit comments

Comments
 (0)