@@ -868,91 +868,28 @@ PyDoc_STRVAR(isal_zlib_compressobj__doc__,
868
868
" containing subsequences that are likely to occur in the input data." );
869
869
870
870
#define ISAL_ZLIB_COMPRESSOBJ_METHODDEF \
871
- {"compressobj", (PyCFunction)(void(*)(void))isal_zlib_compressobj, METH_FASTCALL |METH_KEYWORDS, isal_zlib_compressobj__doc__}
871
+ {"compressobj", (PyCFunction)(void(*)(void))isal_zlib_compressobj, METH_VARARGS |METH_KEYWORDS, isal_zlib_compressobj__doc__}
872
872
873
873
static PyObject *
874
- isal_zlib_compressobj (PyObject * module , PyObject * const * args , Py_ssize_t nargs , PyObject * kwnames )
874
+ isal_zlib_compressobj (PyObject * module , PyObject * args , PyObject * kwargs )
875
875
{
876
876
PyObject * return_value = NULL ;
877
- static const char * const _keywords [] = {"level" , "method" , "wbits" , "memLevel" , "strategy" , "zdict" , NULL };
878
- static _PyArg_Parser _parser = {NULL , _keywords , "compressobj" , 0 };
879
- PyObject * argsbuf [6 ];
880
- Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE (kwnames ) : 0 ) - 0 ;
877
+ char * keywords [] = {"level" , "method" , "wbits" , "memLevel" , "strategy" , "zdict" , NULL };
878
+ char * format = "|iiiiiy*:compressobj" ;
881
879
int level = ISAL_DEFAULT_COMPRESSION ;
882
880
int method = Z_DEFLATED ;
883
881
int wbits = ISAL_DEF_MAX_HIST_BITS ;
884
882
int memLevel = DEF_MEM_LEVEL ;
885
883
int strategy = Z_DEFAULT_STRATEGY ;
886
884
Py_buffer zdict = {NULL , NULL };
887
885
888
- args = _PyArg_UnpackKeywords (args , nargs , NULL , kwnames , & _parser , 0 , 6 , 0 , argsbuf );
889
- if (!args ) {
890
- goto exit ;
891
- }
892
- if (!noptargs ) {
893
- goto skip_optional_pos ;
894
- }
895
- if (args [0 ]) {
896
- level = _PyLong_AsInt (args [0 ]);
897
- if (level == -1 && PyErr_Occurred ()) {
898
- goto exit ;
899
- }
900
- if (!-- noptargs ) {
901
- goto skip_optional_pos ;
902
- }
903
- }
904
- if (args [1 ]) {
905
- method = _PyLong_AsInt (args [1 ]);
906
- if (method == -1 && PyErr_Occurred ()) {
907
- goto exit ;
908
- }
909
- if (!-- noptargs ) {
910
- goto skip_optional_pos ;
911
- }
912
- }
913
- if (args [2 ]) {
914
- wbits = _PyLong_AsInt (args [2 ]);
915
- if (wbits == -1 && PyErr_Occurred ()) {
916
- goto exit ;
917
- }
918
- if (!-- noptargs ) {
919
- goto skip_optional_pos ;
920
- }
921
- }
922
- if (args [3 ]) {
923
- memLevel = _PyLong_AsInt (args [3 ]);
924
- if (memLevel == -1 && PyErr_Occurred ()) {
925
- goto exit ;
926
- }
927
- if (!-- noptargs ) {
928
- goto skip_optional_pos ;
929
- }
930
- }
931
- if (args [4 ]) {
932
- strategy = _PyLong_AsInt (args [4 ]);
933
- if (strategy == -1 && PyErr_Occurred ()) {
934
- goto exit ;
935
- }
936
- if (!-- noptargs ) {
937
- goto skip_optional_pos ;
938
- }
939
- }
940
- if (PyObject_GetBuffer (args [5 ], & zdict , PyBUF_SIMPLE ) != 0 ) {
941
- goto exit ;
942
- }
943
- if (!PyBuffer_IsContiguous (& zdict , 'C' )) {
944
- _PyArg_BadArgument ("compressobj" , "argument 'zdict'" , "contiguous buffer" , args [5 ]);
945
- goto exit ;
886
+ if (!PyArg_ParseTupleAndKeywords (
887
+ args , kwargs , format , keywords ,
888
+ & level , & method , & wbits , & memLevel , & strategy , & zdict )) {
889
+ return NULL ;
946
890
}
947
- skip_optional_pos :
948
891
return_value = isal_zlib_compressobj_impl (module , level , method , wbits , memLevel , strategy , & zdict );
949
-
950
- exit :
951
- /* Cleanup for zdict */
952
- if (zdict .obj ) {
953
- PyBuffer_Release (& zdict );
954
- }
955
-
892
+ PyBuffer_Release (& zdict );
956
893
return return_value ;
957
894
}
958
895
0 commit comments