Skip to content

Commit

Permalink
Deprecate inexact indices to sparse matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
perimosocordiae authored Sep 16, 2017
1 parent 4224aec commit 352456c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scipy/sparse/sputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from __future__ import division, print_function, absolute_import

import operator
import warnings
import numpy as np

Expand Down Expand Up @@ -192,9 +193,17 @@ def isintlike(x):
if np.ndim(x) != 0:
return False
try:
return bool(int(x) == x)
operator.index(x)
except (TypeError, ValueError):
return False
try:
loose_int = bool(int(x) == x)
except (TypeError, ValueError):
return False
if loose_int:
warnings.warn("Inexact indices to sparse matrices are deprecated "
"as of scipy 1.0")
return loose_int
return True


def isshape(x):
Expand Down

0 comments on commit 352456c

Please sign in to comment.