@@ -28,7 +28,7 @@ from cpython.slice cimport PySlice_Check
28
28
cdef int64_t iNaT = util.get_nat()
29
29
30
30
31
- cdef inline is_definitely_invalid_key (object val):
31
+ cdef inline _is_definitely_invalid_key (object val):
32
32
if PyTuple_Check(val):
33
33
try :
34
34
hash (val)
@@ -39,6 +39,8 @@ cdef inline is_definitely_invalid_key(object val):
39
39
return (PySlice_Check(val) or cnp.PyArray_Check(val)
40
40
or PyList_Check(val) or hasattr (val, ' _data' ))
41
41
42
+ def is_definitely_invalid_key (val ):
43
+ return _is_definitely_invalid_key(val)
42
44
43
45
def get_value_at (ndarray arr , object loc ):
44
46
if arr.descr.type_num == NPY_DATETIME:
@@ -138,7 +140,7 @@ cdef class IndexEngine:
138
140
util.set_value_at(arr, loc, value)
139
141
140
142
cpdef get_loc(self , object val):
141
- if is_definitely_invalid_key (val):
143
+ if _is_definitely_invalid_key (val):
142
144
raise TypeError (" '{val}' is an invalid key" .format(val = val))
143
145
144
146
if self .over_size_threshold and self .is_monotonic_increasing:
@@ -441,7 +443,7 @@ cdef class DatetimeEngine(Int64Engine):
441
443
return algos.is_monotonic_int64(values, timelike = True )
442
444
443
445
cpdef get_loc(self , object val):
444
- if is_definitely_invalid_key (val):
446
+ if _is_definitely_invalid_key (val):
445
447
raise TypeError
446
448
447
449
# Welcome to the spaghetti factory
@@ -645,7 +647,7 @@ cdef class MultiIndexHashEngine(ObjectEngine):
645
647
return algos.pad_object(values, other, limit = limit)
646
648
647
649
cpdef get_loc(self , object val):
648
- if is_definitely_invalid_key (val):
650
+ if _is_definitely_invalid_key (val):
649
651
raise TypeError (" '{val}' is an invalid key" .format(val = val))
650
652
651
653
self ._ensure_mapping_populated()
0 commit comments