--- /dev/null
+Handle properly memory allocation failures on str and float opcodes. Patch by
+Victor Stinner.
{
PyStackRef_CLOSE_SPECIALIZED(left, _PyFloat_ExactDealloc);
PyStackRef_CLOSE_SPECIALIZED(right, _PyFloat_ExactDealloc);
- return PyStackRef_FromPyObjectSteal(PyFloat_FromDouble(value));
+ PyObject *obj = PyFloat_FromDouble(value);
+ if (obj == NULL) {
+ return PyStackRef_NULL;
+ }
+ return PyStackRef_FromPyObjectSteal(obj);
}
static PyObject *
PyObject *temp = PyStackRef_AsPyObjectSteal(*target_local);
PyObject *right_o = PyStackRef_AsPyObjectSteal(right);
PyUnicode_Append(&temp, right_o);
- *target_local = PyStackRef_FromPyObjectSteal(temp);
Py_DECREF(right_o);
- ERROR_IF(PyStackRef_IsNull(*target_local));
+ if (temp == NULL) {
+ *target_local = PyStackRef_NULL;
+ ERROR_IF(true);
+ }
+ *target_local = PyStackRef_FromPyObjectSteal(temp);
#if TIER_ONE
// The STORE_FAST is already done. This is done here in tier one,
// and during trace projection in tier two:
assert(WITHIN_STACK_BOUNDS());
_PyFrame_SetStackPointer(frame, stack_pointer);
PyUnicode_Append(&temp, right_o);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- *target_local = PyStackRef_FromPyObjectSteal(temp);
- _PyFrame_SetStackPointer(frame, stack_pointer);
Py_DECREF(right_o);
stack_pointer = _PyFrame_GetStackPointer(frame);
- if (PyStackRef_IsNull(*target_local)) {
+ if (temp == NULL) {
+ *target_local = PyStackRef_NULL;
JUMP_TO_ERROR();
}
+ *target_local = PyStackRef_FromPyObjectSteal(temp);
#if TIER_ONE
assert(next_instr->op.code == STORE_FAST);
assert(WITHIN_STACK_BOUNDS());
_PyFrame_SetStackPointer(frame, stack_pointer);
PyUnicode_Append(&temp, right_o);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- *target_local = PyStackRef_FromPyObjectSteal(temp);
- _PyFrame_SetStackPointer(frame, stack_pointer);
Py_DECREF(right_o);
stack_pointer = _PyFrame_GetStackPointer(frame);
- if (PyStackRef_IsNull(*target_local)) {
+ if (temp == NULL) {
+ *target_local = PyStackRef_NULL;
JUMP_TO_LABEL(error);
}
+ *target_local = PyStackRef_FromPyObjectSteal(temp);
#if TIER_ONE
assert(next_instr->op.code == STORE_FAST);