Skip to content

Commit 7f0061f

Browse files
committed
Address review:
* cleanup: forgotten PyLongWriter_Discard, pylong variable * clarify news
1 parent 6e46bc1 commit 7f0061f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Convert the :mod:`decimal` module to use :pep:`757` API. That offer some
2-
speedup, if integer part of the :class:`~decimal.Decimal` instance is small.
3-
Patch by Sergey B Kirpichev.
1+
Convert the :mod:`decimal` module to use :pep:`757` C API (export-import
2+
integers). That offer some speedup, if integer part of the
3+
:class:`~decimal.Decimal` instance is small. Patch by Sergey B Kirpichev.

Modules/_decimal/_decimal.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,7 +3636,6 @@ dec_format(PyObject *dec, PyObject *args)
36363636
static PyObject *
36373637
dec_as_long(PyObject *dec, PyObject *context, int round)
36383638
{
3639-
PyObject *pylong;
36403639
digit *ob_digit;
36413640
size_t n;
36423641
mpd_t *x;
@@ -3682,7 +3681,6 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
36823681
/* mpd_sizeinbase can overestimate size by 1 digit, set it to zero. */
36833682
ob_digit[n-1] = 0;
36843683
if (writer == NULL) {
3685-
PyLongWriter_Discard(writer);
36863684
mpd_del(x);
36873685
return NULL;
36883686
}
@@ -3704,9 +3702,8 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
37043702
}
37053703

37063704
assert(n > 0);
3707-
pylong = PyLongWriter_Finish(writer);
37083705
mpd_del(x);
3709-
return pylong;
3706+
return PyLongWriter_Finish(writer);
37103707
}
37113708

37123709
/* Convert a Decimal to its exact integer ratio representation. */

0 commit comments

Comments
 (0)