@@ -30,14 +30,43 @@ _stackless_pickle_flags_default(PyObject *module, PyObject *const *args, Py_ssiz
30
30
{
31
31
PyObject * return_value = NULL ;
32
32
static const char * const _keywords [] = {"new_default" , "mask" , NULL };
33
- static _PyArg_Parser _parser = {"|ll:pickle_flags_default" , _keywords , 0 };
33
+ static _PyArg_Parser _parser = {NULL , _keywords , "pickle_flags_default" , 0 };
34
+ PyObject * argsbuf [2 ];
35
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE (kwnames ) : 0 ) - 0 ;
34
36
long new_default = -1 ;
35
37
long mask = -1 ;
36
38
37
- if (! _PyArg_ParseStackAndKeywords ( args , nargs , kwnames , & _parser ,
38
- & new_default , & mask ) ) {
39
+ args = _PyArg_UnpackKeywords ( args , nargs , NULL , kwnames , & _parser , 0 , 2 , 0 , argsbuf );
40
+ if (! args ) {
39
41
goto exit ;
40
42
}
43
+ if (!noptargs ) {
44
+ goto skip_optional_pos ;
45
+ }
46
+ if (args [0 ]) {
47
+ if (PyFloat_Check (args [0 ])) {
48
+ PyErr_SetString (PyExc_TypeError ,
49
+ "integer argument expected, got float" );
50
+ goto exit ;
51
+ }
52
+ new_default = PyLong_AsLong (args [0 ]);
53
+ if (new_default == -1 && PyErr_Occurred ()) {
54
+ goto exit ;
55
+ }
56
+ if (!-- noptargs ) {
57
+ goto skip_optional_pos ;
58
+ }
59
+ }
60
+ if (PyFloat_Check (args [1 ])) {
61
+ PyErr_SetString (PyExc_TypeError ,
62
+ "integer argument expected, got float" );
63
+ goto exit ;
64
+ }
65
+ mask = PyLong_AsLong (args [1 ]);
66
+ if (mask == -1 && PyErr_Occurred ()) {
67
+ goto exit ;
68
+ }
69
+ skip_optional_pos :
41
70
return_value = _stackless_pickle_flags_default_impl (module , new_default , mask );
42
71
43
72
exit :
@@ -81,14 +110,43 @@ _stackless_pickle_flags(PyObject *module, PyObject *const *args, Py_ssize_t narg
81
110
{
82
111
PyObject * return_value = NULL ;
83
112
static const char * const _keywords [] = {"new_flags" , "mask" , NULL };
84
- static _PyArg_Parser _parser = {"|ll:pickle_flags" , _keywords , 0 };
113
+ static _PyArg_Parser _parser = {NULL , _keywords , "pickle_flags" , 0 };
114
+ PyObject * argsbuf [2 ];
115
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE (kwnames ) : 0 ) - 0 ;
85
116
long new_flags = -1 ;
86
117
long mask = -1 ;
87
118
88
- if (!_PyArg_ParseStackAndKeywords (args , nargs , kwnames , & _parser ,
89
- & new_flags , & mask )) {
119
+ args = _PyArg_UnpackKeywords (args , nargs , NULL , kwnames , & _parser , 0 , 2 , 0 , argsbuf );
120
+ if (!args ) {
121
+ goto exit ;
122
+ }
123
+ if (!noptargs ) {
124
+ goto skip_optional_pos ;
125
+ }
126
+ if (args [0 ]) {
127
+ if (PyFloat_Check (args [0 ])) {
128
+ PyErr_SetString (PyExc_TypeError ,
129
+ "integer argument expected, got float" );
130
+ goto exit ;
131
+ }
132
+ new_flags = PyLong_AsLong (args [0 ]);
133
+ if (new_flags == -1 && PyErr_Occurred ()) {
134
+ goto exit ;
135
+ }
136
+ if (!-- noptargs ) {
137
+ goto skip_optional_pos ;
138
+ }
139
+ }
140
+ if (PyFloat_Check (args [1 ])) {
141
+ PyErr_SetString (PyExc_TypeError ,
142
+ "integer argument expected, got float" );
143
+ goto exit ;
144
+ }
145
+ mask = PyLong_AsLong (args [1 ]);
146
+ if (mask == -1 && PyErr_Occurred ()) {
90
147
goto exit ;
91
148
}
149
+ skip_optional_pos :
92
150
return_value = _stackless_pickle_flags_impl (module , new_flags , mask );
93
151
94
152
exit :
@@ -104,4 +162,4 @@ _stackless_pickle_flags(PyObject *module, PyObject *const *args, Py_ssize_t narg
104
162
#ifndef _STACKLESS_PICKLE_FLAGS_METHODDEF
105
163
#define _STACKLESS_PICKLE_FLAGS_METHODDEF
106
164
#endif /* !defined(_STACKLESS_PICKLE_FLAGS_METHODDEF) */
107
- /*[clinic end generated code: output=e59f426d5b04d0fe input=a9049054013a1b77]*/
165
+ /*[clinic end generated code: output=25a1592662352a4a input=a9049054013a1b77]*/
0 commit comments