New submission from Stefan Krah <ste...@bytereef.org>:
This adds a minimal decimal capsule API. As can be seen from the patch, adding anything to decimal while doing it properly is quite labor and testing intensive, so the intent is to *keep* the API minimal! That said, some functions are really necessary: 1) PyDec_TypeCheck() -- for obvious reasons. 2) PyDec_Alloc() -- create new decimals. 3) PyDec_Get() -- get the mpd_t, enables the use of all libmpdec functions. 4) PyDec_AsUint128Triple() -- export the decimal as (sign, hi, lo, exp). 5) PyDec_FromUint128Triple() -- create a decimal from (sign, hi, lo, exp). 4) and 5) have been requested by Antoine for a real world use case. (hi, lo) is the coefficient as a __uint128_t split in two uint64_t. Antoine, could you verify that this is sufficient for the database use case? ---------- nosy: +mark.dickinson, pitrou, rhettinger _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41324> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com