mirror of
https://github.com/python/cpython.git
synced 2026-04-14 15:50:50 +00:00
gh-146092: Fix error handling in _BINARY_OP_ADD_UNICODE opcode (#146117)
Fix also error handling in _BINARY_OP_ADD_FLOAT, _BINARY_OP_SUBTRACT_FLOAT and _BINARY_OP_MULTIPLY_FLOAT opcodes. PyStackRef_FromPyObjectSteal() must not be called with a NULL pointer.
This commit is contained in:
parent
70c7e040d4
commit
1e4ed93210
4 changed files with 66 additions and 48 deletions
|
|
@ -710,10 +710,11 @@ dummy_func(
|
|||
double dres =
|
||||
((PyFloatObject *)left_o)->ob_fval *
|
||||
((PyFloatObject *)right_o)->ob_fval;
|
||||
res = PyStackRef_FromPyObjectSteal(PyFloat_FromDouble(dres));
|
||||
if (PyStackRef_IsNull(res)) {
|
||||
PyObject *d = PyFloat_FromDouble(dres);
|
||||
if (d == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(d);
|
||||
l = left;
|
||||
r = right;
|
||||
INPUTS_DEAD();
|
||||
|
|
@ -729,10 +730,11 @@ dummy_func(
|
|||
double dres =
|
||||
((PyFloatObject *)left_o)->ob_fval +
|
||||
((PyFloatObject *)right_o)->ob_fval;
|
||||
res = PyStackRef_FromPyObjectSteal(PyFloat_FromDouble(dres));
|
||||
if (PyStackRef_IsNull(res)) {
|
||||
PyObject *d = PyFloat_FromDouble(dres);
|
||||
if (d == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(d);
|
||||
l = left;
|
||||
r = right;
|
||||
INPUTS_DEAD();
|
||||
|
|
@ -748,10 +750,11 @@ dummy_func(
|
|||
double dres =
|
||||
((PyFloatObject *)left_o)->ob_fval -
|
||||
((PyFloatObject *)right_o)->ob_fval;
|
||||
res = PyStackRef_FromPyObjectSteal(PyFloat_FromDouble(dres));
|
||||
if (PyStackRef_IsNull(res)) {
|
||||
PyObject *d = PyFloat_FromDouble(dres);
|
||||
if (d == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(d);
|
||||
l = left;
|
||||
r = right;
|
||||
INPUTS_DEAD();
|
||||
|
|
@ -772,10 +775,10 @@ dummy_func(
|
|||
|
||||
STAT_INC(BINARY_OP, hit);
|
||||
PyObject *res_o = PyUnicode_Concat(left_o, right_o);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
if (PyStackRef_IsNull(res)) {
|
||||
if (res_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
l = left;
|
||||
r = right;
|
||||
INPUTS_DEAD();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue