Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
gists
/
cython-cwrapper
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3b2990b3
authored
Sep 29, 2011
by
Gael varoquaux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: Fix the OWNDATA flags of the array
parent
44bc27c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
cython_wrapper.pyx
+6
-0
No files found.
cython_wrapper.pyx
View file @
3b2990b3
...
@@ -40,4 +40,10 @@ def py_compute(int size):
...
@@ -40,4 +40,10 @@ def py_compute(int size):
# new Python object pointing to the existing data
# new Python object pointing to the existing data
ndarray = np.PyArray_SimpleNewFromData(1, shape,
ndarray = np.PyArray_SimpleNewFromData(1, shape,
np.NPY_INT, <void *> array)
np.NPY_INT, <void *> array)
# Tell Python that it can deallocate the memory when the ndarray
# object gets garbage collected
# As the OWNDATA flag of an array is read-only in Python, we need to
# call the C function PyArray_UpdateFlags
np.PyArray_UpdateFlags(ndarray, ndarray.flags.num | np.NPY_OWNDATA)
return ndarray
return ndarray
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment