Skip to content

Commit

Permalink
Add Py_DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieZhao95 committed Jun 26, 2023
1 parent 3b4e823 commit bb4e191
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2308,10 +2308,11 @@ PyDecType_FromFloatExact(PyTypeObject *type, PyObject *v,
mpd_t *d1, *d2;
uint32_t status = 0;
mpd_context_t maxctx;
decimal_state *state = GLOBAL_STATE();

#ifdef Py_DEBUG
decimal_state *state = GLOBAL_STATE();
assert(PyType_IsSubtype(type, state->PyDec_Type));

#endif
if (PyLong_Check(v)) {
return PyDecType_FromLongExact(type, v, context);
}
Expand Down Expand Up @@ -4606,10 +4607,11 @@ dec_richcompare(PyObject *v, PyObject *w, int op)
uint32_t status = 0;
int a_issnan, b_issnan;
int r;
decimal_state *state = GLOBAL_STATE();

#ifdef Py_DEBUG
decimal_state *state = GLOBAL_STATE();
assert(PyDec_Check(state, v));

#endif
CURRENT_CONTEXT(context);
CONVERT_BINOP_CMP(&a, &b, v, w, op, context);

Expand Down

0 comments on commit bb4e191

Please sign in to comment.