@@ -1651,7 +1651,7 @@ _decimal_IEEEContext_impl(PyObject *module, Py_ssize_t bits)
16511651}
16521652
16531653static PyObject *
1654- context_copy (PyObject * self , decimal_state * state )
1654+ context_copy (decimal_state * state , PyObject * v )
16551655{
16561656 PyObject * copy =
16571657 PyObject_CallObject ((PyObject * )state -> PyDecContext_Type , NULL );
@@ -1660,9 +1660,9 @@ context_copy(PyObject *self, decimal_state *state)
16601660 return NULL ;
16611661 }
16621662
1663- * CTX (copy ) = * CTX (self );
1663+ * CTX (copy ) = * CTX (v );
16641664 CTX (copy )-> newtrap = 0 ;
1665- CtxCaps (copy ) = CtxCaps (self );
1665+ CtxCaps (copy ) = CtxCaps (v );
16661666
16671667 return copy ;
16681668}
@@ -1681,7 +1681,7 @@ _decimal_Context_copy_impl(PyObject *self, PyTypeObject *cls)
16811681{
16821682 decimal_state * state = PyType_GetModuleState (cls );
16831683
1684- return context_copy (self , state );
1684+ return context_copy (state , self );
16851685}
16861686
16871687/*[clinic input]
@@ -1695,7 +1695,7 @@ _decimal_Context___copy___impl(PyObject *self, PyTypeObject *cls)
16951695{
16961696 decimal_state * state = PyType_GetModuleState (cls );
16971697
1698- return context_copy (self , state );
1698+ return context_copy (state , self );
16991699}
17001700
17011701/*[clinic input]
@@ -1814,7 +1814,7 @@ current_context_from_dict(decimal_state *modstate)
18141814 }
18151815
18161816 /* Set up a new thread local context. */
1817- tl_context = context_copy (modstate -> default_context_template , modstate );
1817+ tl_context = context_copy (modstate , modstate -> default_context_template );
18181818 if (tl_context == NULL ) {
18191819 return NULL ;
18201820 }
@@ -1890,7 +1890,7 @@ PyDec_SetCurrentContext(PyObject *self, PyObject *v)
18901890 if (v == state -> default_context_template ||
18911891 v == state -> basic_context_template ||
18921892 v == state -> extended_context_template ) {
1893- v = context_copy (v , state );
1893+ v = context_copy (state , v );
18941894 if (v == NULL ) {
18951895 return NULL ;
18961896 }
@@ -1913,7 +1913,7 @@ PyDec_SetCurrentContext(PyObject *self, PyObject *v)
19131913static PyObject *
19141914init_current_context (decimal_state * state )
19151915{
1916- PyObject * tl_context = context_copy (state -> default_context_template , state );
1916+ PyObject * tl_context = context_copy (state , state -> default_context_template );
19171917 if (tl_context == NULL ) {
19181918 return NULL ;
19191919 }
@@ -1974,7 +1974,7 @@ PyDec_SetCurrentContext(PyObject *self, PyObject *v)
19741974 if (v == state -> default_context_template ||
19751975 v == state -> basic_context_template ||
19761976 v == state -> extended_context_template ) {
1977- v = context_copy (v , state );
1977+ v = context_copy (state , v );
19781978 if (v == NULL ) {
19791979 return NULL ;
19801980 }
@@ -2071,7 +2071,7 @@ _decimal_localcontext_impl(PyObject *module, PyObject *local, PyObject *prec,
20712071 return NULL ;
20722072 }
20732073
2074- PyObject * local_copy = context_copy (local , state );
2074+ PyObject * local_copy = context_copy (state , local );
20752075 if (local_copy == NULL ) {
20762076 return NULL ;
20772077 }
0 commit comments