mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-105375: Improve _decimal error handling (GH-105605) (#105647)
Fix a bug where an exception could end up being overwritten.
(cherry picked from commit c932f72849
)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
36ecbc3570
commit
b4b5565e47
2 changed files with 6 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
Fix bug in :mod:`decimal` where an exception could end up being overwritten.
|
|
@ -3615,9 +3615,13 @@ dec_as_integer_ratio(PyObject *self, PyObject *args UNUSED)
|
|||
goto error;
|
||||
}
|
||||
Py_SETREF(numerator, _py_long_floor_divide(numerator, tmp));
|
||||
if (numerator == NULL) {
|
||||
Py_DECREF(tmp);
|
||||
goto error;
|
||||
}
|
||||
Py_SETREF(denominator, _py_long_floor_divide(denominator, tmp));
|
||||
Py_DECREF(tmp);
|
||||
if (numerator == NULL || denominator == NULL) {
|
||||
if (denominator == NULL) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue