Skip to content

Commit 657d7f6

Browse files
committed
Fixed on PyPy
1 parent d86e1ce commit 657d7f6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/pybind11/cast.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,11 @@ struct type_caster<T, enable_if_t<std::is_arithmetic<T>::value && !is_std_char_t
10411041
handle obj = src;
10421042
#if PY_VERSION_HEX < 0x03080000
10431043
bool do_decref = false;
1044-
if (PyIndex_Check(src.ptr())) {
1044+
if (index_check(src.ptr())) {
10451045
PyObject *tmp = PyNumber_Index(src.ptr());
10461046
if (!tmp) {
1047-
py_value = (py_type) -1;
1047+
PyErr_Clear();
1048+
return false;
10481049
}
10491050
do_decref = true;
10501051
obj = tmp;

0 commit comments

Comments
 (0)