mirror of
https://github.com/python/cpython.git
synced 2025-10-10 17:02:46 +00:00
Issue #26200: Restored more safe usages of Py_SETREF.
This commit is contained in:
commit
59865e7fe1
3 changed files with 9 additions and 9 deletions
|
@ -3439,14 +3439,14 @@ dec_as_integer_ratio(PyObject *self, PyObject *args UNUSED)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_XSETREF(exponent, long_methods->nb_power(tmp, exponent, Py_None));
|
Py_SETREF(exponent, long_methods->nb_power(tmp, exponent, Py_None));
|
||||||
Py_DECREF(tmp);
|
Py_DECREF(tmp);
|
||||||
if (exponent == NULL) {
|
if (exponent == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exp >= 0) {
|
if (exp >= 0) {
|
||||||
Py_XSETREF(numerator, long_methods->nb_multiply(numerator, exponent));
|
Py_SETREF(numerator, long_methods->nb_multiply(numerator, exponent));
|
||||||
if (numerator == NULL) {
|
if (numerator == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -3462,8 +3462,8 @@ dec_as_integer_ratio(PyObject *self, PyObject *args UNUSED)
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
Py_XSETREF(numerator, long_methods->nb_floor_divide(numerator, tmp));
|
Py_SETREF(numerator, long_methods->nb_floor_divide(numerator, tmp));
|
||||||
Py_XSETREF(denominator, long_methods->nb_floor_divide(denominator, tmp));
|
Py_SETREF(denominator, long_methods->nb_floor_divide(denominator, tmp));
|
||||||
Py_DECREF(tmp);
|
Py_DECREF(tmp);
|
||||||
if (numerator == NULL || denominator == NULL) {
|
if (numerator == NULL || denominator == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -294,9 +294,9 @@ partial_setstate(partialobject *pto, PyObject *state)
|
||||||
else
|
else
|
||||||
Py_INCREF(dict);
|
Py_INCREF(dict);
|
||||||
|
|
||||||
Py_XSETREF(pto->fn, fn);
|
Py_SETREF(pto->fn, fn);
|
||||||
Py_XSETREF(pto->args, fnargs);
|
Py_SETREF(pto->args, fnargs);
|
||||||
Py_XSETREF(pto->kw, kw);
|
Py_SETREF(pto->kw, kw);
|
||||||
Py_XSETREF(pto->dict, dict);
|
Py_XSETREF(pto->dict, dict);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1494,13 +1494,13 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
|
||||||
|
|
||||||
/* fold in 2**exponent */
|
/* fold in 2**exponent */
|
||||||
if (exponent > 0) {
|
if (exponent > 0) {
|
||||||
Py_XSETREF(numerator,
|
Py_SETREF(numerator,
|
||||||
long_methods->nb_lshift(numerator, py_exponent));
|
long_methods->nb_lshift(numerator, py_exponent));
|
||||||
if (numerator == NULL)
|
if (numerator == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Py_XSETREF(denominator,
|
Py_SETREF(denominator,
|
||||||
long_methods->nb_lshift(denominator, py_exponent));
|
long_methods->nb_lshift(denominator, py_exponent));
|
||||||
if (denominator == NULL)
|
if (denominator == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue