Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Py_DEBUG
  • Loading branch information
CharlieZhao95 committed Jun 26, 2023
commit bb4e1911964ea6e0dfdbcdfbcdd5ef2c2e9e58ed
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