Skip to content

Commit eaf7662

Browse files
Update Python/ceval.c
Co-authored-by: Mark Shannon <Mark.Shannon@arm.com>
1 parent d68c600 commit eaf7662

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

Python/ceval.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,21 +2923,11 @@ _PyEval_SliceIndexNotNone(PyObject *v, Py_ssize_t *pi)
29232923
{
29242924
PyThreadState *tstate = _PyThreadState_GET();
29252925
Py_ssize_t x;
2926-
if (PyLong_CheckExact(v)) {
2927-
if (_PyLong_IsCompact((PyLongObject *)v)) {
2928-
x = _PyLong_CompactValue((PyLongObject *)v);
2929-
}
2930-
else {
2931-
x = PyLong_AsSsize_t(v);
2932-
if (x == -1 && _PyErr_Occurred(tstate)) {
2933-
assert(_PyErr_ExceptionMatches(tstate, PyExc_OverflowError));
2934-
_PyErr_Clear(tstate);
2935-
x = _PyLong_IsNegative((PyLongObject *)v)
2936-
? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX;
2937-
}
2938-
}
2926+
if (PyLong_CheckExact(v) && _PyLong_IsCompact((PyLongObject *)v)) {
2927+
*pi = _PyLong_CompactValue((PyLongObject *)v);
2928+
return 1;
29392929
}
2940-
else if (_PyIndex_Check(v)) {
2930+
if (_PyIndex_Check(v)) {
29412931
x = PyNumber_AsSsize_t(v, NULL);
29422932
if (x == -1 && _PyErr_Occurred(tstate))
29432933
return 0;

0 commit comments

Comments
 (0)