Skip to content

Commit 4d59b3e

Browse files
authored
Merge pull request #162 from m-dz/possible_fix_for_153
Possible fix for #153
2 parents 4774b2b + ce7b60a commit 4d59b3e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

hdbscan/dist_metrics.pxd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
#cython: wraparound=False
44
#cython: cdivision=True
55

6+
import cython
67
cimport cython
8+
9+
import numpy as np
710
cimport numpy as np
11+
812
from libc.math cimport fabs, sqrt, exp, cos, pow
913

1014
ctypedef np.double_t DTYPE_t

hdbscan/dist_metrics.pyx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,9 @@ cdef class PyFuncDistance(DistanceMetric):
11351135
ITYPE_t size) except -1 with gil:
11361136
cdef np.ndarray x1arr
11371137
cdef np.ndarray x2arr
1138-
with gil:
1139-
x1arr = _buffer_to_ndarray(x1, size)
1140-
x2arr = _buffer_to_ndarray(x2, size)
1141-
return self.func(x1arr, x2arr, **self.kwargs)
1138+
x1arr = _buffer_to_ndarray(x1, size)
1139+
x2arr = _buffer_to_ndarray(x2, size)
1140+
return self.func(x1arr, x2arr, **self.kwargs)
11421141

11431142

11441143
cdef inline double fmax(double a, double b) nogil:

0 commit comments

Comments
 (0)