Skip to content

Commit 241a530

Browse files
committed
DOC: Add a note that one should free the proto struct
Really, heap allocating should be very rare and I am not even sure it ever worked (in the error paths at least), but people should be able to work around it easily enough, so give a pointer. Close numpygh-26763
1 parent 735a477 commit 241a530

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/source/reference/c-api/array.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,11 @@ User-defined data types
12401240
With these two changes, the code should compile and work on both 1.x
12411241
and 2.x or later.
12421242
1243+
In the unlikely case that you are heap allocating the dtype struct you
1244+
should free it again on NumPy 2, since a copy is made.
1245+
The struct is not a valid Python object, so do not use ``Py_DECREF``
1246+
on it.
1247+
12431248
Register a data-type as a new user-defined data type for
12441249
arrays. The type must have most of its entries filled in. This is
12451250
not always checked and errors can produce segfaults. In

0 commit comments

Comments
 (0)