Skip to content

Commit 2eb35ac

Browse files
committed
Fixed on PyPy
1 parent 2231d9c commit 2eb35ac

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
@@ -1046,10 +1046,11 @@ struct type_caster<T, enable_if_t<std::is_arithmetic<T>::value && !is_std_char_t
10461046
handle obj = src;
10471047
#if PY_VERSION_HEX < 0x03080000
10481048
bool do_decref = false;
1049-
if (PyIndex_Check(src.ptr())) {
1049+
if (index_check(src.ptr())) {
10501050
PyObject *tmp = PyNumber_Index(src.ptr());
10511051
if (!tmp) {
1052-
py_value = (py_type) -1;
1052+
PyErr_Clear();
1053+
return false;
10531054
}
10541055
do_decref = true;
10551056
obj = tmp;

0 commit comments

Comments
 (0)