This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients mark.dickinson, pitrou, rhettinger, skrah
Date 2020-07-17.11:18:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594984713.74.0.721782226907.issue41324@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-07-17 11:18:33skrahsetrecipients: + skrah, rhettinger, mark.dickinson, pitrou
2020-07-17 11:18:33skrahsetmessageid: <1594984713.74.0.721782226907.issue41324@roundup.psfhosted.org>
2020-07-17 11:18:33skrahlinkissue41324 messages
2020-07-17 11:18:33skrahcreate