Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4b5565

Browse files
[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 commitc932f72)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
1 parent36ecbc3 commitb4b5565

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug in:mod:`decimal` where an exception could end up being overwritten.

‎Modules/_decimal/_decimal.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3615,9 +3615,13 @@ dec_as_integer_ratio(PyObject *self, PyObject *args UNUSED)
36153615
gotoerror;
36163616
}
36173617
Py_SETREF(numerator,_py_long_floor_divide(numerator,tmp));
3618+
if (numerator==NULL) {
3619+
Py_DECREF(tmp);
3620+
gotoerror;
3621+
}
36183622
Py_SETREF(denominator,_py_long_floor_divide(denominator,tmp));
36193623
Py_DECREF(tmp);
3620-
if (numerator==NULL||denominator==NULL) {
3624+
if (denominator==NULL) {
36213625
gotoerror;
36223626
}
36233627
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp