@@ -1014,16 +1014,19 @@ context_setemax(PyObject *self, PyObject *value, void *Py_UNUSED(closure))
1014
1014
}
1015
1015
1016
1016
#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
+
1017
1025
static 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]*/
1019
1028
{
1020
1029
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
- }
1027
1030
1028
1031
if (x < 1 || x > 1070000000L ) {
1029
1032
return value_error_ptr (
@@ -1034,16 +1037,19 @@ context_unsafe_setprec(PyObject *self, PyObject *value)
1034
1037
Py_RETURN_NONE ;
1035
1038
}
1036
1039
1040
+ /*[clinic input]
1041
+ _decimal.Context._unsafe_setemin
1042
+
1043
+ x: Py_ssize_t
1044
+ /
1045
+
1046
+ [clinic start generated code]*/
1047
+
1037
1048
static 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]*/
1039
1051
{
1040
1052
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
- }
1047
1053
1048
1054
if (x < -1070000000L || x > 0 ) {
1049
1055
return value_error_ptr (
@@ -1054,16 +1060,19 @@ context_unsafe_setemin(PyObject *self, PyObject *value)
1054
1060
Py_RETURN_NONE ;
1055
1061
}
1056
1062
1063
+ /*[clinic input]
1064
+ _decimal.Context._unsafe_setemax
1065
+
1066
+ x: Py_ssize_t
1067
+ /
1068
+
1069
+ [clinic start generated code]*/
1070
+
1057
1071
static 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]*/
1059
1074
{
1060
1075
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
- }
1067
1076
1068
1077
if (x < 0 || x > 1070000000L ) {
1069
1078
return value_error_ptr (
@@ -7917,12 +7926,10 @@ static PyMethodDef context_methods [] =
7917
7926
_DECIMAL_CONTEXT_CLEAR_FLAGS_METHODDEF
7918
7927
_DECIMAL_CONTEXT_CLEAR_TRAPS_METHODDEF
7919
7928
7920
- #ifdef CONFIG_32
7921
7929
/* 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
7926
7933
7927
7934
/* Miscellaneous */
7928
7935
_DECIMAL_CONTEXT___COPY___METHODDEF
0 commit comments