@@ -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)
@@ -40,6 +40,10 @@ cdef inline is_definitely_invalid_key(object val):
40
40
or PyList_Check(val) or hasattr (val, ' _data' ))
41
41
42
42
43
+ def is_definitely_invalid_key (val ):
44
+ return _is_definitely_invalid_key(val)
45
+
46
+
43
47
def get_value_at (ndarray arr , object loc ):
44
48
if arr.descr.type_num == NPY_DATETIME:
45
49
return Timestamp(util.get_value_at(arr, loc))
@@ -138,7 +142,7 @@ cdef class IndexEngine:
138
142
util.set_value_at(arr, loc, value)
139
143
140
144
cpdef get_loc(self , object val):
141
- if is_definitely_invalid_key (val):
145
+ if _is_definitely_invalid_key (val):
142
146
raise TypeError (" '{val}' is an invalid key" .format(val = val))
143
147
144
148
if self .over_size_threshold and self .is_monotonic_increasing:
@@ -441,7 +445,7 @@ cdef class DatetimeEngine(Int64Engine):
441
445
return algos.is_monotonic_int64(values, timelike = True )
442
446
443
447
cpdef get_loc(self , object val):
444
- if is_definitely_invalid_key (val):
448
+ if _is_definitely_invalid_key (val):
445
449
raise TypeError
446
450
447
451
# Welcome to the spaghetti factory
@@ -645,7 +649,7 @@ cdef class MultiIndexHashEngine(ObjectEngine):
645
649
return algos.pad_object(values, other, limit = limit)
646
650
647
651
cpdef get_loc(self , object val):
648
- if is_definitely_invalid_key (val):
652
+ if _is_definitely_invalid_key (val):
649
653
raise TypeError (" '{val}' is an invalid key" .format(val = val))
650
654
651
655
self ._ensure_mapping_populated()
0 commit comments