[3.14] gh-146092: Fix error handling in _BINARY_OP_ADD_FLOAT opcode#146119
[3.14] gh-146092: Fix error handling in _BINARY_OP_ADD_FLOAT opcode#146119vstinner wants to merge 2 commits intopython:3.14from
Conversation
Fix error handling in _PyFloat_FromDouble_ConsumeInputs() used by _BINARY_OP_ADD_FLOAT, _BINARY_OP_SUBTRACT_FLOAT and _BINARY_OP_MULTIPLY_FLOAT opcodes. PyStackRef_FromPyObjectSteal() must not be called with a NULL pointer.
|
@Fidget-Spinner: Please review again, I found another bug in PyUnicode_Append(&temp, right_o);
Py_DECREF(right_o);
ERROR_IF(temp == NULL);
*target_local = PyStackRef_FromPyObjectSteal(temp);I don't know if The code in the main branch is different: DEAD(left);
PyUnicode_Append(&temp, right_o);
_Py_DECREF_SPECIALIZED(right_o, _PyUnicode_ExactDealloc);
*target_local = PyStackRef_NULL;
ERROR_IF(temp == NULL);
res = PyStackRef_FromPyObjectSteal(temp); |
I think setting it to PyStackRef_NULL might be wrong? Not too sure. Basically at that point, If you want to be sure. Write a test where the append fails (you can trigger an artificial failure somehow), and check if there's reference leaks. If there's refleaks, then we should not be setting it to |
Fix error handling in _PyFloat_FromDouble_ConsumeInputs() used by _BINARY_OP_ADD_FLOAT, _BINARY_OP_SUBTRACT_FLOAT and _BINARY_OP_MULTIPLY_FLOAT opcodes. PyStackRef_FromPyObjectSteal() must not be called with a NULL pointer.
PyErr_NoMemoryin_zoneinfoload_dataandts_to_local#146092