Skip to content
Merged
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/main' into decimal/contextvar
  • Loading branch information
CharlieZhao95 committed Jul 4, 2023
commit b52f8bded95aa757b8e51bf595a914c96758f9cf
18 changes: 9 additions & 9 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ typedef struct {
#else
PyObject *current_context_var;
#endif

/* Template for creating new thread contexts, calling Context() without
* arguments and initializing the module_context on first access. */
PyObject *default_context_template;

/* Basic and extended context templates */
PyObject *basic_context_template;
PyObject *extended_context_template;
} decimal_state;

static decimal_state global_state;
Expand Down Expand Up @@ -145,14 +153,6 @@ incr_false(void)
return Py_NewRef(Py_False);
}

/* Template for creating new thread contexts, calling Context() without
* arguments and initializing the module_context on first access. */
static PyObject *default_context_template = NULL;
/* Basic and extended context templates */
static PyObject *basic_context_template = NULL;
static PyObject *extended_context_template = NULL;


/* Error codes for functions that return signals or conditions */
#define DEC_INVALID_SIGNALS (MPD_Max_status+1U)
#define DEC_ERR_OCCURRED (DEC_INVALID_SIGNALS<<1)
Expand Down Expand Up @@ -1676,7 +1676,7 @@ static PyObject *
init_current_context(void)
{
decimal_state *state = GLOBAL_STATE();
PyObject *tl_context = context_copy(default_context_template, NULL);
PyObject *tl_context = context_copy(state->default_context_template, NULL);
if (tl_context == NULL) {
return NULL;
}
Expand Down
3 changes: 0 additions & 3 deletions Tools/c-analyzer/cpython/globals-to-fix.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,6 @@ Modules/_datetimemodule.c - us_per_day -
Modules/_datetimemodule.c - us_per_week -
Modules/_datetimemodule.c - seconds_per_day -
Modules/_decimal/_decimal.c - global_state -
Modules/_decimal/_decimal.c - basic_context_template -
Modules/_decimal/_decimal.c - default_context_template -
Modules/_decimal/_decimal.c - extended_context_template -
Modules/_decimal/_decimal.c - round_map -
Modules/_decimal/_decimal.c - Rational -
Modules/_decimal/_decimal.c - SignalTuple -
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.