Skip to content

Commit

Permalink
+ adjust for api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Aug 20, 2024
1 parent a40ae9e commit b7744dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3571,6 +3571,7 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
mpd_t *x;
mpd_context_t workctx;
uint32_t status = 0;
const PyLongLayout *layout = PyLong_GetNativeLayout();

if (mpd_isspecial(MPD(dec))) {
if (mpd_isnan(MPD(dec))) {
Expand Down Expand Up @@ -3599,8 +3600,9 @@ dec_as_long(PyObject *dec, PyObject *context, int round)

status = 0;
n = (mpd_sizeinbase(x, 2) +
PyLong_LAYOUT.bits_per_digit - 1) / PyLong_LAYOUT.bits_per_digit;
PyLongWriter *writer = PyLongWriter_Create(mpd_isnegative(x), n, &ob_digit);
layout->bits_per_digit - 1) / layout->bits_per_digit;
PyLongWriter *writer = PyLongWriter_Create(mpd_isnegative(x), n,
&ob_digit, layout);
/* mpd_sizeinbase can overestimate size by 1 digit, set it to zero. */
ob_digit[n-1] = 0;
if (writer == NULL) {
Expand Down

0 comments on commit b7744dc

Please sign in to comment.