diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bytecodes.c | 250 | ||||
-rw-r--r-- | Python/intrinsics.c | 1 |
2 files changed, 125 insertions, 126 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 6592bc57ed2..7ae687f1bfa 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -156,7 +156,7 @@ dummy_func( QSBR_QUIESCENT_STATE(tstate); if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) { int err = _Py_HandlePending(tstate); - ERROR_IF(err != 0, error); + ERROR_IF(err != 0); } } @@ -166,7 +166,7 @@ dummy_func( QSBR_QUIESCENT_STATE(tstate); if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) { int err = _Py_HandlePending(tstate); - ERROR_IF(err != 0, error); + ERROR_IF(err != 0); } } } @@ -200,7 +200,7 @@ dummy_func( ((_PyThreadStateImpl *)tstate)->tlbc_index) { _Py_CODEUNIT *bytecode = _PyEval_GetExecutableCode(tstate, _PyFrame_GetCode(frame)); - ERROR_IF(bytecode == NULL, error); + ERROR_IF(bytecode == NULL); ptrdiff_t off = this_instr - _PyFrame_GetBytecode(frame); frame->tlbc_index = ((_PyThreadStateImpl *)tstate)->tlbc_index; frame->instr_ptr = bytecode + off; @@ -236,7 +236,7 @@ dummy_func( op(_MONITOR_RESUME, (--)) { int err = _Py_call_instrumentation( tstate, oparg > 0, frame, this_instr); - ERROR_IF(err, error); + ERROR_IF(err); if (frame->instr_ptr != this_instr) { /* Instrumentation has jumped */ next_instr = frame->instr_ptr; @@ -260,7 +260,7 @@ dummy_func( UNBOUNDLOCAL_ERROR_MSG, PyTuple_GetItem(_PyFrame_GetCode(frame)->co_localsplusnames, oparg) ); - ERROR_IF(1, error); + ERROR_IF(true); } value = PyStackRef_DUP(value_s); } @@ -446,7 +446,7 @@ dummy_func( inst(UNARY_NEGATIVE, (value -- res)) { PyObject *res_o = PyNumber_Negative(PyStackRef_AsPyObjectBorrow(value)); PyStackRef_CLOSE(value); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -481,7 +481,7 @@ dummy_func( op(_TO_BOOL, (value -- res)) { int err = PyObject_IsTrue(PyStackRef_AsPyObjectBorrow(value)); PyStackRef_CLOSE(value); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); res = err ? PyStackRef_True : PyStackRef_False; } @@ -576,7 +576,7 @@ dummy_func( inst(UNARY_INVERT, (value -- res)) { PyObject *res_o = PyNumber_Invert(PyStackRef_AsPyObjectBorrow(value)); PyStackRef_CLOSE(value); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -618,7 +618,7 @@ dummy_func( PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc); PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc); INPUTS_DEAD(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -633,7 +633,7 @@ dummy_func( PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc); PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc); INPUTS_DEAD(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -648,7 +648,7 @@ dummy_func( PyStackRef_CLOSE_SPECIALIZED(right, _PyLong_ExactDealloc); PyStackRef_CLOSE_SPECIALIZED(left, _PyLong_ExactDealloc); INPUTS_DEAD(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -681,7 +681,7 @@ dummy_func( ((PyFloatObject *)right_o)->ob_fval; res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres); INPUTS_DEAD(); - ERROR_IF(PyStackRef_IsNull(res), error); + ERROR_IF(PyStackRef_IsNull(res)); } pure op(_BINARY_OP_ADD_FLOAT, (left, right -- res)) { @@ -696,7 +696,7 @@ dummy_func( ((PyFloatObject *)right_o)->ob_fval; res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres); INPUTS_DEAD(); - ERROR_IF(PyStackRef_IsNull(res), error); + ERROR_IF(PyStackRef_IsNull(res)); } pure op(_BINARY_OP_SUBTRACT_FLOAT, (left, right -- res)) { @@ -711,7 +711,7 @@ dummy_func( ((PyFloatObject *)right_o)->ob_fval; res = _PyFloat_FromDouble_ConsumeInputs(left, right, dres); INPUTS_DEAD(); - ERROR_IF(PyStackRef_IsNull(res), error); + ERROR_IF(PyStackRef_IsNull(res)); } macro(BINARY_OP_MULTIPLY_FLOAT) = @@ -732,7 +732,7 @@ dummy_func( PyStackRef_CLOSE_SPECIALIZED(right, _PyUnicode_ExactDealloc); PyStackRef_CLOSE_SPECIALIZED(left, _PyUnicode_ExactDealloc); INPUTS_DEAD(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -780,7 +780,7 @@ dummy_func( PyUnicode_Append(&temp, right_o); *target_local = PyStackRef_FromPyObjectSteal(temp); Py_DECREF(right_o); - ERROR_IF(PyStackRef_IsNull(*target_local), error); + ERROR_IF(PyStackRef_IsNull(*target_local)); #if TIER_ONE // The STORE_FAST is already done. This is done here in tier one, // and during trace projection in tier two: @@ -839,7 +839,7 @@ dummy_func( Py_DECREF(slice); } PyStackRef_CLOSE(container); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -864,7 +864,7 @@ dummy_func( Py_DECREF(slice); } DECREF_INPUTS(); - ERROR_IF(err, error); + ERROR_IF(err); } macro(STORE_SLICE) = _SPECIALIZE_STORE_SLICE + _STORE_SLICE; @@ -978,7 +978,7 @@ dummy_func( _PyErr_SetKeyError(sub); } DECREF_INPUTS(); - ERROR_IF(rc <= 0, error); // not found or error + ERROR_IF(rc <= 0); // not found or error res = PyStackRef_FromPyObjectSteal(res_o); } @@ -1016,13 +1016,13 @@ dummy_func( inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) { int err = _PyList_AppendTakeRef((PyListObject *)PyStackRef_AsPyObjectBorrow(list), PyStackRef_AsPyObjectSteal(v)); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); } inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) { int err = _PySet_AddTakeRef((PySetObject *)PyStackRef_AsPyObjectBorrow(set), PyStackRef_AsPyObjectSteal(v)); - ERROR_IF(err, error); + ERROR_IF(err); } family(STORE_SUBSCR, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = { @@ -1046,7 +1046,7 @@ dummy_func( /* container[sub] = v */ int err = PyObject_SetItem(PyStackRef_AsPyObjectBorrow(container), PyStackRef_AsPyObjectBorrow(sub), PyStackRef_AsPyObjectBorrow(v)); DECREF_INPUTS(); - ERROR_IF(err, error); + ERROR_IF(err); } macro(STORE_SUBSCR) = _SPECIALIZE_STORE_SUBSCR + _STORE_SUBSCR; @@ -1095,7 +1095,7 @@ dummy_func( PyStackRef_AsPyObjectSteal(sub), PyStackRef_AsPyObjectSteal(value)); PyStackRef_CLOSE(dict_st); - ERROR_IF(err, error); + ERROR_IF(err); } inst(DELETE_SUBSCR, (container, sub --)) { @@ -1103,14 +1103,14 @@ dummy_func( int err = PyObject_DelItem(PyStackRef_AsPyObjectBorrow(container), PyStackRef_AsPyObjectBorrow(sub)); DECREF_INPUTS(); - ERROR_IF(err, error); + ERROR_IF(err); } inst(CALL_INTRINSIC_1, (value -- res)) { assert(oparg <= MAX_INTRINSIC_1); PyObject *res_o = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, PyStackRef_AsPyObjectBorrow(value)); PyStackRef_CLOSE(value); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -1121,7 +1121,7 @@ dummy_func( PyObject *res_o = _PyIntrinsics_BinaryFunctions[oparg].func(tstate, value2, value1); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -1135,7 +1135,7 @@ dummy_func( monitor_reraise(tstate, frame, this_instr); goto exception_unwind; } - ERROR_IF(true, error); + ERROR_IF(true); } tier1 inst(INTERPRETER_EXIT, (retval --)) { @@ -1173,7 +1173,7 @@ dummy_func( int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, this_instr, PyStackRef_AsPyObjectBorrow(val)); - ERROR_IF(err, error); + ERROR_IF(err); } macro(INSTRUMENTED_RETURN_VALUE) = @@ -1196,12 +1196,12 @@ dummy_func( "__aiter__ method, got %.100s", type->tp_name); PyStackRef_CLOSE(obj); - ERROR_IF(true, error); + ERROR_IF(true); } iter_o = (*getter)(obj_o); PyStackRef_CLOSE(obj); - ERROR_IF(iter_o == NULL, error); + ERROR_IF(iter_o == NULL); if (Py_TYPE(iter_o)->tp_as_async == NULL || Py_TYPE(iter_o)->tp_as_async->am_anext == NULL) { @@ -1211,7 +1211,7 @@ dummy_func( "that does not implement __anext__: %.100s", Py_TYPE(iter_o)->tp_name); Py_DECREF(iter_o); - ERROR_IF(true, error); + ERROR_IF(true); } iter = PyStackRef_FromPyObjectSteal(iter_o); } @@ -1227,7 +1227,7 @@ dummy_func( inst(GET_AWAITABLE, (iterable -- iter)) { PyObject *iter_o = _PyEval_GetAwaitable(PyStackRef_AsPyObjectBorrow(iterable), oparg); PyStackRef_CLOSE(iterable); - ERROR_IF(iter_o == NULL, error); + ERROR_IF(iter_o == NULL); iter = PyStackRef_FromPyObjectSteal(iter_o); } @@ -1289,7 +1289,7 @@ dummy_func( } else { PyStackRef_CLOSE(v); - ERROR_IF(true, error); + ERROR_IF(true); } } PyStackRef_CLOSE(v); @@ -1450,11 +1450,11 @@ dummy_func( inst(LOAD_BUILD_CLASS, ( -- bc)) { PyObject *bc_o; int err = PyMapping_GetOptionalItem(BUILTINS(), &_Py_ID(__build_class__), &bc_o); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); if (bc_o == NULL) { _PyErr_SetString(tstate, PyExc_NameError, "__build_class__ not found"); - ERROR_IF(true, error); + ERROR_IF(true); } bc = PyStackRef_FromPyObjectSteal(bc_o); } @@ -1467,7 +1467,7 @@ dummy_func( _PyErr_Format(tstate, PyExc_SystemError, "no locals found when storing %R", name); PyStackRef_CLOSE(v); - ERROR_IF(true, error); + ERROR_IF(true); } if (PyDict_CheckExact(ns)) { err = PyDict_SetItem(ns, name, PyStackRef_AsPyObjectBorrow(v)); @@ -1476,7 +1476,7 @@ dummy_func( err = PyObject_SetItem(ns, name, PyStackRef_AsPyObjectBorrow(v)); } PyStackRef_CLOSE(v); - ERROR_IF(err, error); + ERROR_IF(err); } inst(DELETE_NAME, (--)) { @@ -1522,7 +1522,7 @@ dummy_func( PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq); int res = _PyEval_UnpackIterableStackRef(tstate, seq_o, oparg, -1, top); Py_DECREF(seq_o); - ERROR_IF(res == 0, error); + ERROR_IF(res == 0); } macro(UNPACK_SEQUENCE) = _SPECIALIZE_UNPACK_SEQUENCE + _UNPACK_SEQUENCE; @@ -1580,7 +1580,7 @@ dummy_func( PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq); int res = _PyEval_UnpackIterableStackRef(tstate, seq_o, oparg & 0xFF, oparg >> 8, top); Py_DECREF(seq_o); - ERROR_IF(res == 0, error); + ERROR_IF(res == 0); } family(STORE_ATTR, INLINE_CACHE_ENTRIES_STORE_ATTR) = { @@ -1607,7 +1607,7 @@ dummy_func( int err = PyObject_SetAttr(PyStackRef_AsPyObjectBorrow(owner), name, PyStackRef_AsPyObjectBorrow(v)); DECREF_INPUTS(); - ERROR_IF(err, error); + ERROR_IF(err); } macro(STORE_ATTR) = _SPECIALIZE_STORE_ATTR + unused/3 + _STORE_ATTR; @@ -1616,14 +1616,14 @@ dummy_func( PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyObject_DelAttr(PyStackRef_AsPyObjectBorrow(owner), name); PyStackRef_CLOSE(owner); - ERROR_IF(err, error); + ERROR_IF(err); } inst(STORE_GLOBAL, (v --)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); int err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectBorrow(v)); PyStackRef_CLOSE(v); - ERROR_IF(err, error); + ERROR_IF(err); } inst(DELETE_GLOBAL, (--)) { @@ -1645,7 +1645,7 @@ dummy_func( if (l == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, "no locals found"); - ERROR_IF(true, error); + ERROR_IF(true); } locals = PyStackRef_FromPyObjectNew(l); } @@ -1655,7 +1655,7 @@ dummy_func( PyObject *v_o; int err = PyMapping_GetOptionalItem(PyStackRef_AsPyObjectBorrow(mod_or_class_dict), name, &v_o); PyStackRef_CLOSE(mod_or_class_dict); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); if (v_o == NULL) { if (PyDict_CheckExact(GLOBALS()) && PyDict_CheckExact(BUILTINS())) @@ -1677,16 +1677,16 @@ dummy_func( /* Slow-path if globals or builtins is not a dict */ /* namespace 1: globals */ int err = PyMapping_GetOptionalItem(GLOBALS(), name, &v_o); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); if (v_o == NULL) { /* namespace 2: builtins */ int err = PyMapping_GetOptionalItem(BUILTINS(), name, &v_o); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); if (v_o == NULL) { _PyEval_FormatExcCheckArg( tstate, PyExc_NameError, NAME_ERROR_MSG, name); - ERROR_IF(true, error); + ERROR_IF(true); } } } @@ -1697,7 +1697,7 @@ dummy_func( inst(LOAD_NAME, (-- v)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *v_o = _PyEval_LoadName(tstate, frame, name); - ERROR_IF(v_o == NULL, error); + ERROR_IF(v_o == NULL); v = PyStackRef_FromPyObjectSteal(v_o); } @@ -1723,7 +1723,7 @@ dummy_func( op(_LOAD_GLOBAL, ( -- res[1])) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); _PyEval_LoadGlobalStackRef(GLOBALS(), BUILTINS(), name, res); - ERROR_IF(PyStackRef_IsNull(*res), error); + ERROR_IF(PyStackRef_IsNull(*res)); } op(_PUSH_NULL_CONDITIONAL, ( -- null[oparg & 1])) { @@ -1806,7 +1806,7 @@ dummy_func( UNBOUNDLOCAL_ERROR_MSG, PyTuple_GetItem(_PyFrame_GetCode(frame)->co_localsplusnames, oparg) ); - ERROR_IF(1, error); + ERROR_IF(true); } _PyStackRef tmp = GETLOCAL(oparg); GETLOCAL(oparg) = PyStackRef_NULL; @@ -1867,7 +1867,7 @@ dummy_func( value = _PyCell_GetStackRef(cell); if (PyStackRef_IsNull(value)) { _PyEval_FormatExcUnbound(tstate, _PyFrame_GetCode(frame), oparg); - ERROR_IF(true, error); + ERROR_IF(true); } } @@ -1894,12 +1894,12 @@ dummy_func( STACKREFS_TO_PYOBJECTS(pieces, oparg, pieces_o); if (CONVERSION_FAILED(pieces_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *str_o = _PyUnicode_JoinArray(&_Py_STR(empty), pieces_o, oparg); STACKREFS_TO_PYOBJECTS_CLEANUP(pieces_o); DECREF_INPUTS(); - ERROR_IF(str_o == NULL, error); + ERROR_IF(str_o == NULL); str = PyStackRef_FromPyObjectSteal(str_o); } @@ -1937,7 +1937,7 @@ dummy_func( Py_TYPE(iterable)->tp_name); } PyStackRef_CLOSE(iterable_st); - ERROR_IF(true, error); + ERROR_IF(true); } assert(Py_IsNone(none_val)); PyStackRef_CLOSE(iterable_st); @@ -1947,14 +1947,14 @@ dummy_func( int err = _PySet_Update(PyStackRef_AsPyObjectBorrow(set), PyStackRef_AsPyObjectBorrow(iterable)); PyStackRef_CLOSE(iterable); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); } inst(BUILD_SET, (values[oparg] -- set)) { PyObject *set_o = PySet_New(NULL); if (set_o == NULL) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } int err = 0; @@ -1971,7 +1971,7 @@ dummy_func( DEAD(values); if (err) { Py_DECREF(set_o); - ERROR_IF(true, error); + ERROR_IF(true); } INPUTS_DEAD(); @@ -1982,7 +1982,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(values, oparg*2, values_o); if (CONVERSION_FAILED(values_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *map_o = _PyDict_FromItems( values_o, 2, @@ -1990,7 +1990,7 @@ dummy_func( oparg); STACKREFS_TO_PYOBJECTS_CLEANUP(values_o); DECREF_INPUTS(); - ERROR_IF(map_o == NULL, error); + ERROR_IF(map_o == NULL); map = PyStackRef_FromPyObjectStealMortal(map_o); } @@ -1999,18 +1999,18 @@ dummy_func( if (LOCALS() == NULL) { _PyErr_Format(tstate, PyExc_SystemError, "no locals found when setting up annotations"); - ERROR_IF(true, error); + ERROR_IF(true); } /* check if __annotations__ in locals()... */ int err = PyMapping_GetOptionalItem(LOCALS(), &_Py_ID(__annotations__), &ann_dict); - ERROR_IF(err < 0, error); + ERROR_IF(err < 0); if (ann_dict == NULL) { ann_dict = PyDict_New(); - ERROR_IF(ann_dict == NULL, error); + ERROR_IF(ann_dict == NULL); err = PyObject_SetItem(LOCALS(), &_Py_ID(__annotations__), ann_dict); Py_DECREF(ann_dict); - ERROR_IF(err, error); + ERROR_IF(err); } else { Py_DECREF(ann_dict); @@ -2034,7 +2034,7 @@ dummy_func( Py_TYPE(update_o)->tp_name); } PyStackRef_CLOSE(update); - ERROR_IF(true, error); + ERROR_IF(true); } PyStackRef_CLOSE(update); } @@ -2048,7 +2048,7 @@ dummy_func( if (err < 0) { _PyEval_FormatKwargsError(tstate, callable_o, update_o); PyStackRef_CLOSE(update); - ERROR_IF(true, error); + ERROR_IF(true); } PyStackRef_CLOSE(update); } @@ -2063,7 +2063,7 @@ dummy_func( PyStackRef_AsPyObjectSteal(key), PyStackRef_AsPyObjectSteal(value) ); - ERROR_IF(err != 0, error); + ERROR_IF(err != 0); } macro(INSTRUMENTED_LOAD_SUPER_ATTR) = @@ -2101,7 +2101,7 @@ dummy_func( frame, this_instr, global_super, arg); if (err) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } } // we make no attempt to optimize here; specializations should @@ -2125,11 +2125,11 @@ dummy_func( } } DECREF_INPUTS(); - ERROR_IF(super == NULL, error); + ERROR_IF(super == NULL); PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); PyObject *attr_o = PyObject_GetAttr(super, name); Py_DECREF(super); - ERROR_IF(attr_o == NULL, error); + ERROR_IF(attr_o == NULL); attr = PyStackRef_FromPyObjectSteal(attr_o); } @@ -2150,7 +2150,7 @@ dummy_func( PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2); PyObject *attr = _PySuper_Lookup((PyTypeObject *)class, self, name, NULL); DECREF_INPUTS(); - ERROR_IF(attr == NULL, error); + ERROR_IF(attr == NULL); attr_st = PyStackRef_FromPyObjectSteal(attr); } @@ -2236,7 +2236,7 @@ dummy_func( meth | NULL | arg1 | ... | argN */ PyStackRef_CLOSE(owner); - ERROR_IF(attr_o == NULL, error); + ERROR_IF(attr_o == NULL); self_or_null[0] = PyStackRef_NULL; } } @@ -2244,7 +2244,7 @@ dummy_func( /* Classic, pushes one value. */ attr_o = PyObject_GetAttr(PyStackRef_AsPyObjectBorrow(owner), name); PyStackRef_CLOSE(owner); - ERROR_IF(attr_o == NULL, error); + ERROR_IF(attr_o == NULL); } attr = PyStackRef_FromPyObjectSteal(attr_o); } @@ -2608,11 +2608,11 @@ dummy_func( assert((oparg >> 5) <= Py_GE); PyObject *res_o = PyObject_RichCompare(left_o, right_o, oparg >> 5); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); if (oparg & 16) { int res_bool = PyObject_IsTrue(res_o); Py_DECREF(res_o); - ERROR_IF(res_bool < 0, error); + ERROR_IF(res_bool < 0); res = res_bool ? PyStackRef_True : PyStackRef_False; } else { @@ -2706,7 +2706,7 @@ dummy_func( int res = PySequence_Contains(right_o, left_o); DECREF_INPUTS(); - ERROR_IF(res < 0, error); + ERROR_IF(res < 0); b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False; } @@ -2740,7 +2740,7 @@ dummy_func( // Note: both set and frozenset use the same seq_contains method! int res = _PySet_Contains((PySetObject *)right_o, left_o); DECREF_INPUTS(); - ERROR_IF(res < 0, error); + ERROR_IF(res < 0); b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False; } @@ -2754,7 +2754,7 @@ dummy_func( STAT_INC(CONTAINS_OP, hit); int res = PyDict_Contains(right_o, left_o); DECREF_INPUTS(); - ERROR_IF(res < 0, error); + ERROR_IF(res < 0); b = (res ^ oparg) ? PyStackRef_True : PyStackRef_False; } @@ -2764,7 +2764,7 @@ dummy_func( int err = _PyEval_CheckExceptStarTypeValid(tstate, match_type); if (err < 0) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *match_o = NULL; @@ -2772,10 +2772,10 @@ dummy_func( int res = _PyEval_ExceptionGroupMatch(frame, exc_value, match_type, &match_o, &rest_o); DECREF_INPUTS(); - ERROR_IF(res < 0, error); + ERROR_IF(res < 0); assert((match_o == NULL) == (rest_o == NULL)); - ERROR_IF(match_o == NULL, error); + ERROR_IF(match_o == NULL); if (!Py_IsNone(match_o)) { PyErr_SetHandledException(match_o); @@ -2805,14 +2805,14 @@ dummy_func( PyStackRef_AsPyObjectBorrow(fromlist), PyStackRef_AsPyObjectBorrow(level)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } inst(IMPORT_FROM, (from -- from, res)) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); PyObject *res_o = _PyEval_ImportFrom(tstate, PyStackRef_AsPyObjectBorrow(from), name); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -2850,7 +2850,7 @@ dummy_func( int optimized = _PyOptimizer_Optimize(frame, start, &executor, 0); if (optimized <= 0) { this_instr[1].counter = restart_backoff_counter(counter); - ERROR_IF(optimized < 0, error); + ERROR_IF(optimized < 0); } else { this_instr[1].counter = initial_jump_backoff_counter(); @@ -2976,9 +2976,9 @@ dummy_func( inst(GET_LEN, (obj -- obj, len)) { // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(PyStackRef_AsPyObjectBorrow(obj)); - ERROR_IF(len_i < 0, error); + ERROR_IF(len_i < 0); PyObject *len_o = PyLong_FromSsize_t(len_i); - ERROR_IF(len_o == NULL, error); + ERROR_IF(len_o == NULL); len = PyStackRef_FromPyObjectSteal(len_o); } @@ -2996,7 +2996,7 @@ dummy_func( attrs = PyStackRef_FromPyObjectSteal(attrs_o); } else { - ERROR_IF(_PyErr_Occurred(tstate), error); // Error! + ERROR_IF(_PyErr_Occurred(tstate)); // Error! attrs = PyStackRef_None; // Failure! } } @@ -3015,7 +3015,7 @@ dummy_func( // On successful match, PUSH(values). Otherwise, PUSH(None). PyObject *values_or_none_o = _PyEval_MatchKeys(tstate, PyStackRef_AsPyObjectBorrow(subject), PyStackRef_AsPyObjectBorrow(keys)); - ERROR_IF(values_or_none_o == NULL, error); + ERROR_IF(values_or_none_o == NULL); values_or_none = PyStackRef_FromPyObjectSteal(values_or_none_o); } @@ -3026,7 +3026,7 @@ dummy_func( /* before: [obj]; after [getiter(obj)] */ PyObject *iter_o = PyObject_GetIter(PyStackRef_AsPyObjectBorrow(iterable)); PyStackRef_CLOSE(iterable); - ERROR_IF(iter_o == NULL, error); + ERROR_IF(iter_o == NULL); iter = PyStackRef_FromPyObjectSteal(iter_o); } @@ -3377,7 +3377,7 @@ dummy_func( r->start = value + r->step; r->len--; PyObject *res = PyLong_FromLong(value); - ERROR_IF(res == NULL, error); + ERROR_IF(res == NULL); next = PyStackRef_FromPyObjectSteal(res); } @@ -3470,7 +3470,7 @@ dummy_func( PyObject *res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self, (3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); Py_XDECREF(original_tb); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -3704,7 +3704,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *res_o = PyObject_Vectorcall( callable_o, args_o, @@ -3730,7 +3730,7 @@ dummy_func( } assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -3752,7 +3752,7 @@ dummy_func( tstate, PY_MONITORING_EVENT_CALL, frame, this_instr, function, arg0 ); - ERROR_IF(err, error); + ERROR_IF(err); } macro(CALL) = _SPECIALIZE_CALL + unused/2 + _MAYBE_EXPAND_METHOD + _DO_CALL + _CHECK_PERIODIC; @@ -3857,7 +3857,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *res_o = PyObject_Vectorcall( callable_o, args_o, @@ -3866,7 +3866,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4009,7 +4009,7 @@ dummy_func( (void)callable; // Silence compiler warnings about unused variables (void)null; PyStackRef_CLOSE(arg); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4037,7 +4037,7 @@ dummy_func( (void)callable; // Silence compiler warnings about unused variables (void)null; PyStackRef_CLOSE(arg); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4130,12 +4130,12 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *res_o = tp->tp_vectorcall((PyObject *)tp, args_o, total_args, NULL); STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4170,7 +4170,7 @@ dummy_func( DEAD(args); DEAD(self_or_null); PyStackRef_CLOSE(callable); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4198,7 +4198,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *res_o = _PyCFunctionFast_CAST(cfunc)( PyCFunction_GET_SELF(callable_o), @@ -4207,7 +4207,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4237,13 +4237,13 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *res_o = cfunc(PyCFunction_GET_SELF(callable_o), args_o, total_args, NULL); STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4325,7 +4325,7 @@ dummy_func( UNLOCK_OBJECT(self_o); PyStackRef_CLOSE(self); PyStackRef_CLOSE(callable); - ERROR_IF(err, error); + ERROR_IF(err); #if TIER_ONE // Skip the following POP_TOP. This is done here in tier one, and // during trace projection in tier two: @@ -4363,7 +4363,7 @@ dummy_func( _Py_LeaveRecursiveCallTstate(tstate); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4397,7 +4397,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(meth->ml_meth); @@ -4405,7 +4405,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4443,7 +4443,7 @@ dummy_func( DEAD(args); DEAD(self_or_null); PyStackRef_CLOSE(callable); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4477,14 +4477,14 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth); PyObject *res_o = cfunc(self, (args_o + 1), nargs); STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4517,7 +4517,7 @@ dummy_func( int err = _Py_call_instrumentation_2args( tstate, PY_MONITORING_EVENT_CALL, frame, this_instr, function, arg); - ERROR_IF(err, error); + ERROR_IF(err); } op(_MAYBE_EXPAND_METHOD_KW, (callable, self_or_null, unused[oparg], unused -- callable, self_or_null, unused[oparg], unused)) { @@ -4574,7 +4574,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *res_o = PyObject_Vectorcall( callable_o, args_o, @@ -4599,7 +4599,7 @@ dummy_func( } } DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4629,7 +4629,7 @@ dummy_func( DEAD(self_or_null); DEAD(callable); SYNC_SP(); - ERROR_IF(temp == NULL, error); + ERROR_IF(temp == NULL); new_frame = temp; } @@ -4727,7 +4727,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o); if (CONVERSION_FAILED(args_o)) { DECREF_INPUTS(); - ERROR_IF(true, error); + ERROR_IF(true); } PyObject *kwnames_o = PyStackRef_AsPyObjectBorrow(kwnames); int positional_args = total_args - (int)PyTuple_GET_SIZE(kwnames_o); @@ -4739,7 +4739,7 @@ dummy_func( STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -4842,7 +4842,7 @@ dummy_func( PyStackRef_CLOSE(callargs_st); DEAD(null); PyStackRef_CLOSE(func_st); - ERROR_IF(result_o == NULL, error); + ERROR_IF(result_o == NULL); result = PyStackRef_FromPyObjectSteal(result_o); } @@ -4863,7 +4863,7 @@ dummy_func( PyFunction_New(codeobj, GLOBALS()); PyStackRef_CLOSE(codeobj_st); - ERROR_IF(func_obj == NULL, error); + ERROR_IF(func_obj == NULL); _PyFunction_SetVersion( func_obj, ((PyCodeObject *)codeobj)->co_version); @@ -4887,7 +4887,7 @@ dummy_func( assert(PyStackRef_FunctionCheck(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj); PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); - ERROR_IF(gen == NULL, error); + ERROR_IF(gen == NULL); assert(STACK_LEVEL() == 0); SAVE_STACK(); _PyInterpreterFrame *gen_frame = &gen->gi_iframe; @@ -4912,7 +4912,7 @@ dummy_func( PyObject *step_o = oparg == 3 ? PyStackRef_AsPyObjectBorrow(args[2]) : NULL; PyObject *slice_o = PySlice_New(start_o, stop_o, step_o); DECREF_INPUTS(); - ERROR_IF(slice_o == NULL, error); + ERROR_IF(slice_o == NULL); slice = PyStackRef_FromPyObjectStealMortal(slice_o); } @@ -4922,7 +4922,7 @@ dummy_func( conv_fn = _PyEval_ConversionFuncs[oparg]; PyObject *result_o = conv_fn(PyStackRef_AsPyObjectBorrow(value)); PyStackRef_CLOSE(value); - ERROR_IF(result_o == NULL, error); + ERROR_IF(result_o == NULL); result = PyStackRef_FromPyObjectSteal(result_o); } @@ -4933,7 +4933,7 @@ dummy_func( if (!PyUnicode_CheckExact(value_o)) { PyObject *res_o = PyObject_Format(value_o, NULL); PyStackRef_CLOSE(value); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } else { @@ -4945,7 +4945,7 @@ dummy_func( inst(FORMAT_WITH_SPEC, (value, fmt_spec -- res)) { PyObject *res_o = PyObject_Format(PyStackRef_AsPyObjectBorrow(value), PyStackRef_AsPyObjectBorrow(fmt_spec)); DECREF_INPUTS(); - ERROR_IF(res_o == NULL, error); + ERROR_IF(res_o == NULL); res = PyStackRef_FromPyObjectSteal(res_o); } @@ -5024,7 +5024,7 @@ dummy_func( inst(INSTRUMENTED_INSTRUCTION, ( -- )) { int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, this_instr); - ERROR_IF(next_opcode < 0, error); + ERROR_IF(next_opcode < 0); next_instr = this_instr; if (_PyOpcode_Caches[next_opcode]) { PAUSE_ADAPTIVE_COUNTER(next_instr[1].counter); diff --git a/Python/intrinsics.c b/Python/intrinsics.c index 1c7d7ee6c12..ff44ba0ee64 100644 --- a/Python/intrinsics.c +++ b/Python/intrinsics.c @@ -28,7 +28,6 @@ static PyObject * print_expr(PyThreadState* Py_UNUSED(ignored), PyObject *value) { PyObject *hook = _PySys_GetRequiredAttr(&_Py_ID(displayhook)); - // Can't use ERROR_IF here. if (hook == NULL) { return NULL; } |