@@ -1014,16 +1014,19 @@ context_setemax(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
10141014}
10151015
10161016#ifdef CONFIG_32
1017+ /*[clinic input]
1018+ _decimal.Context._unsafe_setprec
1019+
1020+ x: Py_ssize_t
1021+ /
1022+
1023+ [clinic start generated code]*/
1024+
10171025static PyObject *
1018- context_unsafe_setprec (PyObject * self , PyObject * value )
1026+ _decimal_Context__unsafe_setprec_impl (PyObject * self , Py_ssize_t x )
1027+ /*[clinic end generated code: output=dd838edf08e12dd9 input=23a1b19ceb1569be]*/
10191028{
10201029 mpd_context_t * ctx = CTX (self );
1021- mpd_ssize_t x ;
1022-
1023- x = PyLong_AsSsize_t (value );
1024- if (x == -1 && PyErr_Occurred ()) {
1025- return NULL ;
1026- }
10271030
10281031 if (x < 1 || x > 1070000000L ) {
10291032 return value_error_ptr (
@@ -1034,16 +1037,19 @@ context_unsafe_setprec(PyObject *self, PyObject *value)
10341037 Py_RETURN_NONE ;
10351038}
10361039
1040+ /*[clinic input]
1041+ _decimal.Context._unsafe_setemin
1042+
1043+ x: Py_ssize_t
1044+ /
1045+
1046+ [clinic start generated code]*/
1047+
10371048static PyObject *
1038- context_unsafe_setemin (PyObject * self , PyObject * value )
1049+ _decimal_Context__unsafe_setemin_impl (PyObject * self , Py_ssize_t x )
1050+ /*[clinic end generated code: output=0c49cafee8a65846 input=652f1ecacca7e0ce]*/
10391051{
10401052 mpd_context_t * ctx = CTX (self );
1041- mpd_ssize_t x ;
1042-
1043- x = PyLong_AsSsize_t (value );
1044- if (x == -1 && PyErr_Occurred ()) {
1045- return NULL ;
1046- }
10471053
10481054 if (x < -1070000000L || x > 0 ) {
10491055 return value_error_ptr (
@@ -1054,16 +1060,19 @@ context_unsafe_setemin(PyObject *self, PyObject *value)
10541060 Py_RETURN_NONE ;
10551061}
10561062
1063+ /*[clinic input]
1064+ _decimal.Context._unsafe_setemax
1065+
1066+ x: Py_ssize_t
1067+ /
1068+
1069+ [clinic start generated code]*/
1070+
10571071static PyObject *
1058- context_unsafe_setemax (PyObject * self , PyObject * value )
1072+ _decimal_Context__unsafe_setemax_impl (PyObject * self , Py_ssize_t x )
1073+ /*[clinic end generated code: output=776563e0377a00e8 input=b2a32a9a2750e7a8]*/
10591074{
10601075 mpd_context_t * ctx = CTX (self );
1061- mpd_ssize_t x ;
1062-
1063- x = PyLong_AsSsize_t (value );
1064- if (x == -1 && PyErr_Occurred ()) {
1065- return NULL ;
1066- }
10671076
10681077 if (x < 0 || x > 1070000000L ) {
10691078 return value_error_ptr (
@@ -7917,12 +7926,10 @@ static PyMethodDef context_methods [] =
79177926 _DECIMAL_CONTEXT_CLEAR_FLAGS_METHODDEF
79187927 _DECIMAL_CONTEXT_CLEAR_TRAPS_METHODDEF
79197928
7920- #ifdef CONFIG_32
79217929 /* Unsafe set functions with relaxed range checks */
7922- { "_unsafe_setprec" , context_unsafe_setprec , METH_O , NULL },
7923- { "_unsafe_setemin" , context_unsafe_setemin , METH_O , NULL },
7924- { "_unsafe_setemax" , context_unsafe_setemax , METH_O , NULL },
7925- #endif
7930+ _DECIMAL_CONTEXT__UNSAFE_SETPREC_METHODDEF
7931+ _DECIMAL_CONTEXT__UNSAFE_SETEMIN_METHODDEF
7932+ _DECIMAL_CONTEXT__UNSAFE_SETEMAX_METHODDEF
79267933
79277934 /* Miscellaneous */
79287935 _DECIMAL_CONTEXT___COPY___METHODDEF
0 commit comments