Skip to content

Commit

Permalink
Fix error on Windows in heapq.pyx of issue malcolmw#36 by specifying …
Browse files Browse the repository at this point in the history
…dtype

Addressing Issue malcolmw#36 The expected type was 'Py_ssize_t', but 'long' was provided instead. This led to runtime exception. The solution was to explicitly set the dtype parameter to np.intp in the np.full function call. 

This modification resolves the error on Windows by ensuring the type matches the expected 'Py_ssize_t', as np.intp is the numpy data type that maps to 'ssize_t' on the platform being compiled on, thus aligning with Python's indexing types and C's ssize_t on Windows.
  • Loading branch information
Cleaf-y authored Mar 10, 2024
1 parent d91d914 commit 86e05c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pykonal/heapq.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cdef class Heap(object):
"""
def __init__(self, values):
self.cy_values = values
self.cy_heap_index = np.full(values.shape, fill_value=-1)
self.cy_heap_index = np.full(values.shape, fill_value=-1, dtype=np.intp)


@property
Expand Down

0 comments on commit 86e05c8

Please sign in to comment.