Skip to content

Commit 951209a

Browse files
authored
[MRG] dist: check metric is a string before calling a str method (#379)
1 parent b001d7a commit 951209a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ot/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def dist(x1, x2=None, metric='sqeuclidean', p=2, w=None):
232232
if not get_backend(x1, x2).__name__ == 'numpy':
233233
raise NotImplementedError()
234234
else:
235-
if metric.endswith("minkowski"):
235+
if isinstance(metric, str) and metric.endswith("minkowski"):
236236
return cdist(x1, x2, metric=metric, p=p, w=w)
237237
return cdist(x1, x2, metric=metric, w=w)
238238

0 commit comments

Comments
 (0)