I remember that one of the concerns with cdecimal was whether it could be maintained by anyone except Stefan (and a few people who were already overcommitted).
If anyone (including absolute newbies) wants to step up, now would be a good time to get involved. A few starter questions, whose answer it would be good to document: Why is there any need for MPD_MINALLOC at all for (immutable) numbers? I suspect that will involve fleshing out some of the memory management issues around dynamic decimals, as touched on here: http://www.bytereef.org/mpdecimal/doc/libmpdec/memory.html#static-and-dynamic-decimals On Mon, Apr 9, 2012 at 3:33 PM, stefan.krah <python-check...@python.org> wrote: > http://hg.python.org/cpython/rev/170bdc5c798b > changeset: 76197:170bdc5c798b > parent: 76184:02ecb8261cd8 > user: Stefan Krah <sk...@bytereef.org> > date: Mon Apr 09 20:47:57 2012 +0200 > summary: > Resize the coefficient to MPD_MINALLOC also if the requested size is below > MPD_MINALLOC. Previously the resize was skipped as a micro optimization. > > files: > Modules/_decimal/libmpdec/mpdecimal.c | 36 ++++++++------ > 1 files changed, 20 insertions(+), 16 deletions(-) > > > diff --git a/Modules/_decimal/libmpdec/mpdecimal.c > b/Modules/_decimal/libmpdec/mpdecimal.c > --- a/Modules/_decimal/libmpdec/mpdecimal.c > +++ b/Modules/_decimal/libmpdec/mpdecimal.c > @@ -480,17 +480,20 @@ > { > assert(!mpd_isconst_data(result)); /* illegal operation for a const */ > assert(!mpd_isshared_data(result)); /* illegal operation for a shared */ > - > + assert(MPD_MINALLOC <= result->alloc); > + > + nwords = (nwords <= MPD_MINALLOC) ? MPD_MINALLOC : nwords; > + if (nwords == result->alloc) { > + return 1; > + } > if (mpd_isstatic_data(result)) { > if (nwords > result->alloc) { > return mpd_switch_to_dyn(result, nwords, status); > } > - } > - else if (nwords != result->alloc && nwords >= MPD_MINALLOC) { > - return mpd_realloc_dyn(result, nwords, status); > - } > - > - return 1; > + return 1; > + } > + > + return mpd_realloc_dyn(result, nwords, status); > } > > /* Same as mpd_qresize, but the complete coefficient (including the old > @@ -500,20 +503,21 @@ > { > assert(!mpd_isconst_data(result)); /* illegal operation for a const */ > assert(!mpd_isshared_data(result)); /* illegal operation for a shared */ > - > - if (mpd_isstatic_data(result)) { > - if (nwords > result->alloc) { > - return mpd_switch_to_dyn_zero(result, nwords, status); > - } > - } > - else if (nwords != result->alloc && nwords >= MPD_MINALLOC) { > - if (!mpd_realloc_dyn(result, nwords, status)) { > + assert(MPD_MINALLOC <= result->alloc); > + > + nwords = (nwords <= MPD_MINALLOC) ? MPD_MINALLOC : nwords; > + if (nwords != result->alloc) { > + if (mpd_isstatic_data(result)) { > + if (nwords > result->alloc) { > + return mpd_switch_to_dyn_zero(result, nwords, status); > + } > + } > + else if (!mpd_realloc_dyn(result, nwords, status)) { > return 0; > } > } > > mpd_uint_zero(result->data, nwords); > - > return 1; > } > > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > python-check...@python.org > http://mail.python.org/mailman/listinfo/python-checkins > _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com