Skip to content

Commit e658f2b

Browse files
committed
address review: comment
1 parent 336e881 commit e658f2b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/_decimal/_decimal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,11 @@ dec_as_long(PyObject *dec, PyObject *context, int round)
36893689
assert(layout->digit_size == 2 || layout->digit_size == 4);
36903690

36913691
uint32_t base = (uint32_t)1 << layout->bits_per_digit;
3692+
/* We use a temporary buffer for digits for now, as for nonzero rdata
3693+
mpd_qexport_u32/u16() require either space "allocated by one of
3694+
libmpdec’s allocation functions" or "rlen MUST be correct" (to avoid
3695+
reallocation). This can be further optimized by using rlen from
3696+
mpd_sizeinbase(). See gh-127925. */
36923697
void *tmp_digits = NULL;
36933698
size_t n;
36943699

0 commit comments

Comments
 (0)