@@ -4468,18 +4468,20 @@ nm_##MPDFUNC(PyObject *self, PyObject *other) \
4468
4468
}
4469
4469
4470
4470
/* Boolean function with an optional context arg.
4471
- Argument Clinic provides PyObject *self, PyObject *context
4471
+ Argument Clinic provides PyObject *self, PyTypeObject *cls,
4472
+ PyObject *context
4472
4473
*/
4473
4474
#define Dec_BoolFuncVA (MPDFUNC ) \
4474
4475
{ \
4475
- decimal_state *state = get_module_state_by_def(Py_TYPE(self)); \
4476
+ decimal_state *state = PyType_GetModuleState(cls); \
4476
4477
CONTEXT_CHECK_VA(state, context); \
4477
4478
\
4478
4479
return MPDFUNC(MPD(self), CTX(context)) ? incr_true() : incr_false(); \
4479
4480
}
4480
4481
4481
4482
/* Unary function with an optional context arg.
4482
- Argument Clinic provides PyObject *self, PyObject *context
4483
+ Argument Clinic provides PyObject *self, PyTypeObject *cls,
4484
+ PyObject *context
4483
4485
*/
4484
4486
#define Dec_UnaryFuncVA (MPDFUNC ) \
4485
4487
{ \
@@ -4502,7 +4504,8 @@ nm_##MPDFUNC(PyObject *self, PyObject *other) \
4502
4504
}
4503
4505
4504
4506
/* Binary function with an optional context arg.
4505
- Argument Clinic provides PyObject *self, PyObject *other, PyObject *context
4507
+ Argument Clinic provides PyObject *self, PyTypeObject *cls,
4508
+ PyObject *other, PyObject *context
4506
4509
*/
4507
4510
#define Dec_BinaryFuncVA (MPDFUNC ) \
4508
4511
{ \
@@ -4534,7 +4537,8 @@ nm_##MPDFUNC(PyObject *self, PyObject *other) \
4534
4537
NOT take a context. The context is used to record InvalidOperation
4535
4538
if the second operand cannot be converted exactly.
4536
4539
4537
- Argument Clinic provides PyObject *self, PyObject *other, PyObject *context
4540
+ Argument Clinic provides PyObject *self, PyTypeObject *cls,
4541
+ PyObject *other, PyObject *context
4538
4542
*/
4539
4543
#define Dec_BinaryFuncVA_NO_CTX (MPDFUNC ) \
4540
4544
{ \
@@ -4559,7 +4563,8 @@ nm_##MPDFUNC(PyObject *self, PyObject *other) \
4559
4563
}
4560
4564
4561
4565
/* Ternary function with an optional context arg.
4562
- Argument Clinic provides PyObject *self, PyObject *other, PyObject *third,
4566
+ Argument Clinic provides PyObject *self, PyTypeObject *cls,
4567
+ PyObject *other, PyObject *third,
4563
4568
PyObject *context
4564
4569
*/
4565
4570
#define Dec_TernaryFuncVA (MPDFUNC ) \
@@ -6194,7 +6199,8 @@ static PyType_Spec dec_spec = {
6194
6199
}
6195
6200
6196
6201
/* Unary context method.
6197
- Argument Clinic provides PyObject *context, PyObject *x
6202
+ Argument Clinic provides PyObject *context,
6203
+ PyTypeObject *cls, PyObject *x
6198
6204
*/
6199
6205
#define DecCtx_UnaryFunc (MPDFUNC ) \
6200
6206
{ \
@@ -6219,7 +6225,8 @@ static PyType_Spec dec_spec = {
6219
6225
}
6220
6226
6221
6227
/* Binary context method.
6222
- Argument Clinic provides PyObject *context, PyObject *x, PyObject *y
6228
+ Argument Clinic provides PyObject *context, PyTypeObject *cls,
6229
+ PyObject *x, PyObject *y
6223
6230
*/
6224
6231
#define DecCtx_BinaryFunc (MPDFUNC ) \
6225
6232
{ \
@@ -6249,7 +6256,8 @@ static PyType_Spec dec_spec = {
6249
6256
/*
6250
6257
* Binary context method. The context is only used for conversion.
6251
6258
* The actual MPDFUNC does NOT take a context arg.
6252
- * Argument Clinic provides PyObject *context, PyObject *x, PyObject *y
6259
+ * Argument Clinic provides PyObject *context, PyTypeObject *cls,
6260
+ * PyObject *x, PyObject *y
6253
6261
*/
6254
6262
#define DecCtx_BinaryFunc_NO_CTX (MPDFUNC ) \
6255
6263
{ \
@@ -6273,8 +6281,8 @@ static PyType_Spec dec_spec = {
6273
6281
}
6274
6282
6275
6283
/* Ternary context method.
6276
- Argument Clinic provides PyObject *context, PyObject *x, PyObject *y ,
6277
- PyObject *z
6284
+ Argument Clinic provides PyObject *context, PyTypeObject *cls ,
6285
+ PyObject *x, PyObject *y, PyObject * z
6278
6286
*/
6279
6287
#define DecCtx_TernaryFunc (MPDFUNC ) \
6280
6288
{ \
0 commit comments