#ifndef Py_BUILD_CORE_BUILTIN
#define Py_BUILD_CORE_MODULE …
#endif
#include <Python.h>
#include "pycore_long.h"
#include "pycore_pystate.h"
#include "pycore_typeobject.h"
#include "complexobject.h"
#include <mpdecimal.h>
#if defined(MPD_CONFIG_64)
#ifndef CONFIG_64
#define CONFIG_64 …
#endif
#elif defined(MPD_CONFIG_32)
#ifndef CONFIG_32
#define CONFIG_32 …
#endif
#endif
#include <ctype.h>
#include <stdlib.h>
#include "docstrings.h"
#ifdef EXTRA_FUNCTIONALITY
#define _PY_DEC_ROUND_GUARD …
#else
#define _PY_DEC_ROUND_GUARD …
#endif
struct PyDecContextObject;
struct DecCondMap;
decimal_state;
static inline decimal_state *
get_module_state(PyObject *mod)
{ … }
static struct PyModuleDef _decimal_module;
static PyType_Spec dec_spec;
static PyType_Spec context_spec;
static inline decimal_state *
get_module_state_by_def(PyTypeObject *tp)
{ … }
static inline decimal_state *
find_state_left_or_right(PyObject *left, PyObject *right)
{ … }
#if !defined(MPD_VERSION_HEX) || MPD_VERSION_HEX < 0x02050000
#error "libmpdec version >= 2.5.0 required"
#endif
#ifdef TEST_COVERAGE
#undef Py_LOCAL_INLINE
#define Py_LOCAL_INLINE …
#endif
#define MPD_Float_operation …
#define BOUNDS_CHECK(x, MIN, MAX) …
#define _Py_DEC_MINALLOC …
PyDecObject;
PyDecSignalDictObject;
PyDecContextObject;
PyDecContextManagerObject;
#undef MPD
#undef CTX
#define PyDec_CheckExact(st, v) …
#define PyDec_Check(st, v) …
#define PyDecSignalDict_Check(st, v) …
#define PyDecContext_Check(st, v) …
#define MPD(v) …
#define SdFlagAddr(v) …
#define SdFlags(v) …
#define CTX(v) …
#define CtxCaps(v) …
static inline decimal_state *
get_module_state_from_ctx(PyObject *v)
{ … }
Py_LOCAL_INLINE(PyObject *)
incr_true(void)
{ … }
Py_LOCAL_INLINE(PyObject *)
incr_false(void)
{ … }
#define DEC_INVALID_SIGNALS …
#define DEC_ERR_OCCURRED …
#define DEC_ERRORS …
DecCondMap;
#define SUBNORMAL …
#define INEXACT …
#define ROUNDED …
#define SIGNAL_MAP_LEN …
static DecCondMap signal_map_template[] = …;
static DecCondMap cond_map_template[] = …;
static inline DecCondMap *
dec_cond_map_init(DecCondMap *template, Py_ssize_t size)
{ … }
static const char *dec_signal_string[MPD_NUM_FLAGS] = …;
static const char *invalid_rounding_err = …;
static const char *invalid_signals_err = …;
#ifdef EXTRA_FUNCTIONALITY
static const char *invalid_flags_err =
"valid values for _flags or _traps are:\n\
signals:\n\
[DecIEEEInvalidOperation, DecFloatOperation, DecDivisionByZero,\n\
DecOverflow, DecUnderflow, DecSubnormal, DecInexact, DecRounded,\n\
DecClamped]\n\
conditions which trigger DecIEEEInvalidOperation:\n\
[DecInvalidOperation, DecConversionSyntax, DecDivisionImpossible,\n\
DecDivisionUndefined, DecFpuError, DecInvalidContext, DecMallocError]";
#endif
static int
value_error_int(const char *mesg)
{ … }
static PyObject *
value_error_ptr(const char *mesg)
{ … }
static int
type_error_int(const char *mesg)
{ … }
static int
runtime_error_int(const char *mesg)
{ … }
#define INTERNAL_ERROR_INT(funcname) …
static PyObject *
runtime_error_ptr(const char *mesg)
{ … }
#define INTERNAL_ERROR_PTR(funcname) …
static void
dec_traphandler(mpd_context_t *Py_UNUSED(ctx))
{ … }
static PyObject *
flags_as_exception(decimal_state *state, uint32_t flags)
{ … }
Py_LOCAL_INLINE(uint32_t)
exception_as_flag(decimal_state *state, PyObject *ex)
{ … }
static PyObject *
flags_as_list(decimal_state *state, uint32_t flags)
{ … }
static PyObject *
signals_as_list(decimal_state *state, uint32_t flags)
{ … }
static uint32_t
list_as_flags(decimal_state *state, PyObject *list)
{ … }
static PyObject *
flags_as_dict(decimal_state *state, uint32_t flags)
{ … }
static uint32_t
dict_as_flags(decimal_state *state, PyObject *val)
{ … }
#ifdef EXTRA_FUNCTIONALITY
static uint32_t
long_as_flags(PyObject *v)
{
long x;
x = PyLong_AsLong(v);
if (x == -1 && PyErr_Occurred()) {
return DEC_ERR_OCCURRED;
}
if (x < 0 || x > (long)MPD_Max_status) {
PyErr_SetString(PyExc_TypeError, invalid_flags_err);
return DEC_INVALID_SIGNALS;
}
return x;
}
#endif
static int
dec_addstatus(PyObject *context, uint32_t status)
{ … }
static int
getround(decimal_state *state, PyObject *v)
{ … }
static const char *INVALID_SIGNALDICT_ERROR_MSG = …;
static int
signaldict_init(PyObject *self,
PyObject *Py_UNUSED(args), PyObject *Py_UNUSED(kwds))
{ … }
static Py_ssize_t
signaldict_len(PyObject *self)
{ … }
static PyObject *
signaldict_iter(PyObject *self)
{ … }
static PyObject *
signaldict_getitem(PyObject *self, PyObject *key)
{ … }
static int
signaldict_setitem(PyObject *self, PyObject *key, PyObject *value)
{ … }
static int
signaldict_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static void
signaldict_dealloc(PyObject *self)
{ … }
static PyObject *
signaldict_repr(PyObject *self)
{ … }
static PyObject *
signaldict_richcompare(PyObject *v, PyObject *w, int op)
{ … }
static PyObject *
signaldict_copy(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyMethodDef signaldict_methods[] = …;
static PyType_Slot signaldict_slots[] = …;
static PyType_Spec signaldict_spec = …;
#define Dec_CONTEXT_GET_SSIZE(mem) …
#define Dec_CONTEXT_GET_ULONG(mem) …
Dec_CONTEXT_GET_SSIZE(…)
Dec_CONTEXT_GET_SSIZE(…)
Dec_CONTEXT_GET_SSIZE(…)
Dec_CONTEXT_GET_SSIZE(…)
#ifdef EXTRA_FUNCTIONALITY
Dec_CONTEXT_GET_ULONG(traps)
Dec_CONTEXT_GET_ULONG(status)
#endif
static PyObject *
context_getround(PyObject *self, void *Py_UNUSED(closure))
{ … }
static PyObject *
context_getcapitals(PyObject *self, void *Py_UNUSED(closure))
{ … }
#ifdef EXTRA_FUNCTIONALITY
static PyObject *
context_getallcr(PyObject *self, void *Py_UNUSED(closure))
{
return PyLong_FromLong(mpd_getcr(CTX(self)));
}
#endif
static PyObject *
context_getetiny(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
context_getetop(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static int
context_setprec(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{ … }
static int
context_setemin(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{ … }
static int
context_setemax(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{ … }
#ifdef CONFIG_32
static PyObject *
context_unsafe_setprec(PyObject *self, PyObject *value)
{
mpd_context_t *ctx = CTX(self);
mpd_ssize_t x;
x = PyLong_AsSsize_t(value);
if (x == -1 && PyErr_Occurred()) {
return NULL;
}
if (x < 1 || x > 1070000000L) {
return value_error_ptr(
"valid range for unsafe prec is [1, 1070000000]");
}
ctx->prec = x;
Py_RETURN_NONE;
}
static PyObject *
context_unsafe_setemin(PyObject *self, PyObject *value)
{
mpd_context_t *ctx = CTX(self);
mpd_ssize_t x;
x = PyLong_AsSsize_t(value);
if (x == -1 && PyErr_Occurred()) {
return NULL;
}
if (x < -1070000000L || x > 0) {
return value_error_ptr(
"valid range for unsafe emin is [-1070000000, 0]");
}
ctx->emin = x;
Py_RETURN_NONE;
}
static PyObject *
context_unsafe_setemax(PyObject *self, PyObject *value)
{
mpd_context_t *ctx = CTX(self);
mpd_ssize_t x;
x = PyLong_AsSsize_t(value);
if (x == -1 && PyErr_Occurred()) {
return NULL;
}
if (x < 0 || x > 1070000000L) {
return value_error_ptr(
"valid range for unsafe emax is [0, 1070000000]");
}
ctx->emax = x;
Py_RETURN_NONE;
}
#endif
static int
context_setround(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{ … }
static int
context_setcapitals(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{ … }
#ifdef EXTRA_FUNCTIONALITY
static int
context_settraps(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{
mpd_context_t *ctx;
uint32_t flags;
flags = long_as_flags(value);
if (flags & DEC_ERRORS) {
return -1;
}
ctx = CTX(self);
if (!mpd_qsettraps(ctx, flags)) {
INTERNAL_ERROR_INT("context_settraps");
}
return 0;
}
#endif
static int
context_settraps_list(PyObject *self, PyObject *value)
{ … }
static int
context_settraps_dict(PyObject *self, PyObject *value)
{ … }
#ifdef EXTRA_FUNCTIONALITY
static int
context_setstatus(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{
mpd_context_t *ctx;
uint32_t flags;
flags = long_as_flags(value);
if (flags & DEC_ERRORS) {
return -1;
}
ctx = CTX(self);
if (!mpd_qsetstatus(ctx, flags)) {
INTERNAL_ERROR_INT("context_setstatus");
}
return 0;
}
#endif
static int
context_setstatus_list(PyObject *self, PyObject *value)
{ … }
static int
context_setstatus_dict(PyObject *self, PyObject *value)
{ … }
static int
context_setclamp(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{ … }
#ifdef EXTRA_FUNCTIONALITY
static int
context_setallcr(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
{
mpd_context_t *ctx;
mpd_ssize_t x;
x = PyLong_AsSsize_t(value);
if (x == -1 && PyErr_Occurred()) {
return -1;
}
BOUNDS_CHECK(x, INT_MIN, INT_MAX);
ctx = CTX(self);
if (!mpd_qsetcr(ctx, (int)x)) {
return value_error_int("valid values for _allcr are 0 or 1");
}
return 0;
}
#endif
static PyObject *
context_getattr(PyObject *self, PyObject *name)
{ … }
static int
context_setattr(PyObject *self, PyObject *name, PyObject *value)
{ … }
static int
context_setattrs(PyObject *self, PyObject *prec, PyObject *rounding,
PyObject *emin, PyObject *emax, PyObject *capitals,
PyObject *clamp, PyObject *status, PyObject *traps) { … }
static PyObject *
context_clear_traps(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
context_clear_flags(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
#define DEC_DFLT_EMAX …
#define DEC_DFLT_EMIN …
static mpd_context_t dflt_ctx = …;
static PyObject *
context_new(PyTypeObject *type,
PyObject *Py_UNUSED(args), PyObject *Py_UNUSED(kwds))
{ … }
static int
context_traverse(PyDecContextObject *self, visitproc visit, void *arg)
{ … }
static int
context_clear(PyDecContextObject *self)
{ … }
static void
context_dealloc(PyDecContextObject *self)
{ … }
static int
context_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
context_repr(PyDecContextObject *self)
{ … }
static void
init_basic_context(PyObject *v)
{ … }
static void
init_extended_context(PyObject *v)
{ … }
#ifdef EXTRA_FUNCTIONALITY
static PyObject *
ieee_context(PyObject *module, PyObject *v)
{
PyObject *context;
mpd_ssize_t bits;
mpd_context_t ctx;
bits = PyLong_AsSsize_t(v);
if (bits == -1 && PyErr_Occurred()) {
return NULL;
}
if (bits <= 0 || bits > INT_MAX) {
goto error;
}
if (mpd_ieee_context(&ctx, (int)bits) < 0) {
goto error;
}
decimal_state *state = get_module_state(module);
context = PyObject_CallObject((PyObject *)state->PyDecContext_Type, NULL);
if (context == NULL) {
return NULL;
}
*CTX(context) = ctx;
return context;
error:
PyErr_Format(PyExc_ValueError,
"argument must be a multiple of 32, with a maximum of %d",
MPD_IEEE_CONTEXT_MAX_BITS);
return NULL;
}
#endif
static PyObject *
context_copy(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
context_reduce(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyGetSetDef context_getsets [] = …;
#define CONTEXT_CHECK(state, obj) …
#define CONTEXT_CHECK_VA(state, obj) …
#ifndef WITH_DECIMAL_CONTEXTVAR
static PyObject *
current_context_from_dict(decimal_state *modstate)
{
PyThreadState *tstate = _PyThreadState_GET();
#ifdef Py_DEBUG
_Py_EnsureTstateNotNULL(tstate);
#endif
PyObject *dict = _PyThreadState_GetDict(tstate);
if (dict == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"cannot get thread state");
return NULL;
}
PyObject *tl_context;
tl_context = PyDict_GetItemWithError(dict, modstate->tls_context_key);
if (tl_context != NULL) {
CONTEXT_CHECK(modstate, tl_context);
}
else {
if (PyErr_Occurred()) {
return NULL;
}
tl_context = context_copy(modstate->default_context_template, NULL);
if (tl_context == NULL) {
return NULL;
}
CTX(tl_context)->status = 0;
if (PyDict_SetItem(dict, modstate->tls_context_key, tl_context) < 0) {
Py_DECREF(tl_context);
return NULL;
}
Py_DECREF(tl_context);
}
Py_XSETREF(modstate->cached_context,
(PyDecContextObject *)Py_NewRef(tl_context));
modstate->cached_context->tstate = tstate;
return tl_context;
}
static PyObject *
current_context(decimal_state *modstate)
{
PyThreadState *tstate = _PyThreadState_GET();
if (modstate->cached_context && modstate->cached_context->tstate == tstate) {
return (PyObject *)(modstate->cached_context);
}
return current_context_from_dict(modstate);
}
#define CURRENT_CONTEXT …
static PyObject *
PyDec_GetCurrentContext(PyObject *self, PyObject *Py_UNUSED(dummy))
{
PyObject *context;
decimal_state *state = get_module_state(self);
CURRENT_CONTEXT(state, context);
return Py_NewRef(context);
}
static PyObject *
PyDec_SetCurrentContext(PyObject *self, PyObject *v)
{
PyObject *dict;
decimal_state *state = get_module_state(self);
CONTEXT_CHECK(state, v);
dict = PyThreadState_GetDict();
if (dict == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"cannot get thread state");
return NULL;
}
if (v == state->default_context_template ||
v == state->basic_context_template ||
v == state->extended_context_template) {
v = context_copy(v, NULL);
if (v == NULL) {
return NULL;
}
CTX(v)->status = 0;
}
else {
Py_INCREF(v);
}
Py_CLEAR(state->cached_context);
if (PyDict_SetItem(dict, state->tls_context_key, v) < 0) {
Py_DECREF(v);
return NULL;
}
Py_DECREF(v);
Py_RETURN_NONE;
}
#else
static PyObject *
init_current_context(decimal_state *state)
{ … }
static inline PyObject *
current_context(decimal_state *state)
{ … }
#define CURRENT_CONTEXT(STATE, CTXOBJ) …
static PyObject *
PyDec_GetCurrentContext(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
PyDec_SetCurrentContext(PyObject *self, PyObject *v)
{ … }
#endif
static PyObject *
ctxmanager_new(PyObject *m, PyObject *args, PyObject *kwds)
{ … }
static int
ctxmanager_traverse(PyDecContextManagerObject *self, visitproc visit,
void *arg)
{ … }
static int
ctxmanager_clear(PyDecContextManagerObject *self)
{ … }
static void
ctxmanager_dealloc(PyDecContextManagerObject *self)
{ … }
static PyObject *
ctxmanager_set_local(PyDecContextManagerObject *self,
PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
ctxmanager_restore_global(PyDecContextManagerObject *self,
PyObject *Py_UNUSED(args))
{ … }
static PyMethodDef ctxmanager_methods[] = …;
static PyType_Slot ctxmanager_slots[] = …;
static PyType_Spec ctxmanager_spec = …;
static PyObject *
PyDecType_New(decimal_state *state, PyTypeObject *type)
{ … }
#define dec_alloc(st) …
static int
dec_traverse(PyObject *dec, visitproc visit, void *arg)
{ … }
static void
dec_dealloc(PyObject *dec)
{ … }
Py_LOCAL_INLINE(int)
is_space(int kind, const void *data, Py_ssize_t pos)
{ … }
static char *
numeric_as_ascii(PyObject *u, int strip_ws, int ignore_underscores)
{ … }
static PyObject *
PyDecType_FromCString(PyTypeObject *type, const char *s,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromCStringExact(PyTypeObject *type, const char *s,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromUnicode(PyTypeObject *type, PyObject *u,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromUnicodeExactWS(PyTypeObject *type, PyObject *u,
PyObject *context)
{ … }
Py_LOCAL_INLINE(void)
_dec_settriple(PyObject *dec, uint8_t sign, uint32_t v, mpd_ssize_t exp)
{ … }
static PyObject *
PyDecType_FromSsize(PyTypeObject *type, mpd_ssize_t v, PyObject *context)
{ … }
static PyObject *
PyDecType_FromSsizeExact(PyTypeObject *type, mpd_ssize_t v, PyObject *context)
{ … }
static PyObject *
dec_from_long(decimal_state *state, PyTypeObject *type, PyObject *v,
const mpd_context_t *ctx, uint32_t *status)
{ … }
static PyObject *
PyDecType_FromLong(PyTypeObject *type, PyObject *v, PyObject *context)
{ … }
static PyObject *
PyDecType_FromLongExact(PyTypeObject *type, PyObject *v,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromFloatExact(PyTypeObject *type, PyObject *v,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromFloat(PyTypeObject *type, PyObject *v,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromDecimalExact(PyTypeObject *type, PyObject *v, PyObject *context)
{ … }
static PyObject *
sequence_as_tuple(PyObject *v, PyObject *ex, const char *mesg)
{ … }
static char *
dectuple_as_str(PyObject *dectuple)
{ … }
static PyObject *
PyDecType_FromSequence(PyTypeObject *type, PyObject *v,
PyObject *context)
{ … }
static PyObject *
PyDecType_FromSequenceExact(PyTypeObject *type, PyObject *v,
PyObject *context)
{ … }
#define PyDec_FromCString(st, str, context) …
#define PyDec_FromCStringExact(st, str, context) …
#define PyDec_FromUnicode(st, unicode, context) …
#define PyDec_FromUnicodeExact(st, unicode, context) …
#define PyDec_FromUnicodeExactWS(st, unicode, context) …
#define PyDec_FromSsize(st, v, context) …
#define PyDec_FromSsizeExact(st, v, context) …
#define PyDec_FromLong(st, pylong, context) …
#define PyDec_FromLongExact(st, pylong, context) …
#define PyDec_FromFloat(st, pyfloat, context) …
#define PyDec_FromFloatExact(st, pyfloat, context) …
#define PyDec_FromSequence(st, sequence, context) …
#define PyDec_FromSequenceExact(st, sequence, context) …
static PyObject *
dec_from_float(PyObject *type, PyObject *pyfloat)
{ … }
static PyObject *
PyDecType_FromNumberExact(PyTypeObject *type, PyObject *v, PyObject *context)
{ … }
static PyObject *
dec_from_number(PyObject *type, PyObject *number)
{ … }
static PyObject *
ctx_from_float(PyObject *context, PyObject *v)
{ … }
static PyObject *
dec_apply(PyObject *v, PyObject *context)
{ … }
static PyObject *
PyDecType_FromObjectExact(PyTypeObject *type, PyObject *v, PyObject *context)
{ … }
static PyObject *
PyDec_FromObject(PyObject *v, PyObject *context)
{ … }
static PyObject *
dec_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
ctx_create_decimal(PyObject *context, PyObject *args)
{ … }
#define NOT_IMPL …
#define TYPE_ERR …
Py_LOCAL_INLINE(int)
convert_op(int type_err, PyObject **conv, PyObject *v, PyObject *context)
{ … }
#define CONVERT_OP(a, v, context) …
#define CONVERT_BINOP(a, b, v, w, context) …
#define CONVERT_TERNOP(a, b, c, v, w, x, context) …
#define CONVERT_OP_RAISE(a, v, context) …
#define CONVERT_BINOP_RAISE(a, b, v, w, context) …
#define CONVERT_TERNOP_RAISE(a, b, c, v, w, x, context) …
static PyObject *
multiply_by_denominator(PyObject *v, PyObject *r, PyObject *context)
{ … }
static PyObject *
numerator_as_decimal(PyObject *r, PyObject *context)
{ … }
static int
convert_op_cmp(PyObject **vcmp, PyObject **wcmp, PyObject *v, PyObject *w,
int op, PyObject *context)
{ … }
#define CONVERT_BINOP_CMP(vcmp, wcmp, v, w, op, ctx) … \
static PyObject *
unicode_fromascii(const char *s, Py_ssize_t size)
{ … }
static PyObject *
dec_str(PyObject *dec)
{ … }
static PyObject *
dec_repr(PyObject *dec)
{ … }
static char *
dec_strdup(const char *src, Py_ssize_t size)
{ … }
static void
dec_replace_fillchar(char *dest)
{ … }
static PyObject *
dotsep_as_utf8(const char *s)
{ … }
static int
dict_get_item_string(PyObject *dict, const char *key, PyObject **valueobj, const char **valuestr)
{ … }
static PyObject *
pydec_format(PyObject *dec, PyObject *context, PyObject *fmt, decimal_state *state)
{ … }
static PyObject *
dec_format(PyObject *dec, PyObject *args)
{ … }
static PyObject *
dec_as_long(PyObject *dec, PyObject *context, int round)
{ … }
static PyObject *
dec_as_integer_ratio(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
PyDec_ToIntegralValue(PyObject *dec, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
PyDec_ToIntegralExact(PyObject *dec, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
PyDec_AsFloat(PyObject *dec)
{ … }
static PyObject *
PyDec_Round(PyObject *dec, PyObject *args)
{ … }
static PyObject *
PyDec_AsTuple(PyObject *dec, PyObject *Py_UNUSED(dummy))
{ … }
#define Dec_UnaryNumberMethod(MPDFUNC) …
#define Dec_BinaryNumberMethod(MPDFUNC) …
#define Dec_BoolFunc(MPDFUNC) …
#define Dec_BoolFuncVA(MPDFUNC) …
#define Dec_UnaryFuncVA(MPDFUNC) …
#define Dec_BinaryFuncVA(MPDFUNC) …
#define Dec_BinaryFuncVA_NO_CTX(MPDFUNC) …
#define Dec_TernaryFuncVA(MPDFUNC) …
Dec_UnaryNumberMethod(…)
Dec_UnaryNumberMethod(…)
Dec_UnaryNumberMethod(…)
Dec_BinaryNumberMethod(…)
Dec_BinaryNumberMethod(…)
Dec_BinaryNumberMethod(…)
Dec_BinaryNumberMethod(…)
Dec_BinaryNumberMethod(…)
Dec_BinaryNumberMethod(…)
static PyObject *
nm_dec_as_long(PyObject *dec)
{ … }
static int
nm_nonzero(PyObject *v)
{ … }
static PyObject *
nm_mpd_qdivmod(PyObject *v, PyObject *w)
{ … }
static PyObject *
nm_mpd_qpow(PyObject *base, PyObject *exp, PyObject *mod)
{ … }
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_TernaryFuncVA(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFunc(…)
Dec_BoolFuncVA(…)
Dec_BoolFuncVA(…)
static PyObject *
dec_mpd_adjexp(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_canonical(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_conjugate(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static inline PyObject *
_dec_mpd_radix(decimal_state *state)
{ … }
static PyObject *
dec_mpd_radix(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_mpd_qcopy_abs(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_mpd_qcopy_negate(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
Dec_UnaryFuncVA(…)
Dec_UnaryFuncVA(…)
static PyObject *
dec_mpd_class(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
dec_mpd_to_eng(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
Dec_BinaryFuncVA_NO_CTX(…)
Dec_BinaryFuncVA_NO_CTX(…)
static PyObject *
dec_mpd_qcopy_sign(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
dec_mpd_same_quantum(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
Dec_BinaryFuncVA(…)
static PyObject *
dec_mpd_qquantize(PyObject *v, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
dec_richcompare(PyObject *v, PyObject *w, int op)
{ … }
static PyObject *
dec_ceil(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_complex(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_copy(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_floor(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static Py_hash_t
_dec_hash(PyDecObject *v)
{ … }
static Py_hash_t
dec_hash(PyDecObject *self)
{ … }
static PyObject *
dec_reduce(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_sizeof(PyObject *v, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_trunc(PyObject *self, PyObject *Py_UNUSED(dummy))
{ … }
static PyObject *
dec_real(PyObject *self, void *Py_UNUSED(closure))
{ … }
static PyObject *
dec_imag(PyObject *self, void *Py_UNUSED(closure))
{ … }
static PyGetSetDef dec_getsets [] = …;
static PyMethodDef dec_methods [] = …;
static PyType_Slot dec_slots[] = …;
static PyType_Spec dec_spec = …;
#define DecCtx_BoolFunc(MPDFUNC) …
#define DecCtx_BoolFunc_NO_CTX(MPDFUNC) …
#define DecCtx_UnaryFunc(MPDFUNC) …
#define DecCtx_BinaryFunc(MPDFUNC) …
#define DecCtx_BinaryFunc_NO_CTX(MPDFUNC) …
#define DecCtx_TernaryFunc(MPDFUNC) …
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
static PyObject *
ctx_mpd_qdivmod(PyObject *context, PyObject *args)
{ … }
static PyObject *
ctx_mpd_qpow(PyObject *context, PyObject *args, PyObject *kwds)
{ … }
DecCtx_TernaryFunc(…)
static PyObject *
ctx_mpd_radix(PyObject *context, PyObject *dummy)
{ … }
DecCtx_BoolFunc(…)
DecCtx_BoolFunc(…)
DecCtx_BoolFunc_NO_CTX(…)
DecCtx_BoolFunc_NO_CTX(…)
DecCtx_BoolFunc_NO_CTX(…)
DecCtx_BoolFunc_NO_CTX(…)
DecCtx_BoolFunc_NO_CTX(…)
DecCtx_BoolFunc_NO_CTX(…)
DecCtx_BoolFunc_NO_CTX(…)
static PyObject *
ctx_iscanonical(PyObject *context, PyObject *v)
{ … }
static PyObject *
PyDecContext_Apply(PyObject *context, PyObject *v)
{ … }
static PyObject *
ctx_canonical(PyObject *context, PyObject *v)
{ … }
static PyObject *
ctx_mpd_qcopy_abs(PyObject *context, PyObject *v)
{ … }
static PyObject *
ctx_copy_decimal(PyObject *context, PyObject *v)
{ … }
static PyObject *
ctx_mpd_qcopy_negate(PyObject *context, PyObject *v)
{ … }
DecCtx_UnaryFunc(…)
DecCtx_UnaryFunc(…)
static PyObject *
ctx_mpd_class(PyObject *context, PyObject *v)
{ … }
static PyObject *
ctx_mpd_to_sci(PyObject *context, PyObject *v)
{ … }
static PyObject *
ctx_mpd_to_eng(PyObject *context, PyObject *v)
{ … }
DecCtx_BinaryFunc_NO_CTX(…)
DecCtx_BinaryFunc_NO_CTX(…)
static PyObject *
ctx_mpd_qcopy_sign(PyObject *context, PyObject *args)
{ … }
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
DecCtx_BinaryFunc(…)
static PyObject *
ctx_mpd_same_quantum(PyObject *context, PyObject *args)
{ … }
static PyMethodDef context_methods [] = …;
static PyType_Slot context_slots[] = …;
static PyType_Spec context_spec = …;
static PyMethodDef _decimal_methods [] = …;
struct ssize_constmap { … };
static struct ssize_constmap ssize_constants [] = …;
struct int_constmap { … };
static struct int_constmap int_constants [] = …;
#define CHECK_INT(expr) …
#define ASSIGN_PTR(result, expr) …
#define CHECK_PTR(expr) …
static PyCFunction
cfunc_noargs(PyTypeObject *t, const char *name)
{ … }
static int minalloc_is_set = …;
static int
_decimal_exec(PyObject *m)
{ … }
static int
decimal_traverse(PyObject *module, visitproc visit, void *arg)
{ … }
static int
decimal_clear(PyObject *module)
{ … }
static void
decimal_free(void *module)
{ … }
static struct PyModuleDef_Slot _decimal_slots[] = …;
static struct PyModuleDef _decimal_module = …;
PyMODINIT_FUNC
PyInit__decimal(void)
{ … }