@@ -9696,40 +9696,40 @@ split(PyObject *self,
9696
9696
const void * buf1 , * buf2 ;
9697
9697
Py_ssize_t len1 , len2 ;
9698
9698
PyObject * out ;
9699
-
9700
- if (maxcount < 0 )
9701
- maxcount = PY_SSIZE_T_MAX ;
9699
+ len1 = PyUnicode_GET_LENGTH (self );
9700
+ kind1 = PyUnicode_KIND (self );
9701
+ if (maxcount < 0 ) {
9702
+ maxcount = len1 ;
9703
+ }
9702
9704
9703
9705
if (substring == NULL )
9704
- switch (PyUnicode_KIND ( self ) ) {
9706
+ switch (kind1 ) {
9705
9707
case PyUnicode_1BYTE_KIND :
9706
9708
if (PyUnicode_IS_ASCII (self ))
9707
9709
return asciilib_split_whitespace (
9708
9710
self , PyUnicode_1BYTE_DATA (self ),
9709
- PyUnicode_GET_LENGTH ( self ) , maxcount
9711
+ len1 , maxcount
9710
9712
);
9711
9713
else
9712
9714
return ucs1lib_split_whitespace (
9713
9715
self , PyUnicode_1BYTE_DATA (self ),
9714
- PyUnicode_GET_LENGTH ( self ) , maxcount
9716
+ len1 , maxcount
9715
9717
);
9716
9718
case PyUnicode_2BYTE_KIND :
9717
9719
return ucs2lib_split_whitespace (
9718
9720
self , PyUnicode_2BYTE_DATA (self ),
9719
- PyUnicode_GET_LENGTH ( self ) , maxcount
9721
+ len1 , maxcount
9720
9722
);
9721
9723
case PyUnicode_4BYTE_KIND :
9722
9724
return ucs4lib_split_whitespace (
9723
9725
self , PyUnicode_4BYTE_DATA (self ),
9724
- PyUnicode_GET_LENGTH ( self ) , maxcount
9726
+ len1 , maxcount
9725
9727
);
9726
9728
default :
9727
9729
Py_UNREACHABLE ();
9728
9730
}
9729
9731
9730
- kind1 = PyUnicode_KIND (self );
9731
9732
kind2 = PyUnicode_KIND (substring );
9732
- len1 = PyUnicode_GET_LENGTH (self );
9733
9733
len2 = PyUnicode_GET_LENGTH (substring );
9734
9734
if (kind1 < kind2 || len1 < len2 ) {
9735
9735
out = PyList_New (1 );
@@ -9783,39 +9783,40 @@ rsplit(PyObject *self,
9783
9783
Py_ssize_t len1 , len2 ;
9784
9784
PyObject * out ;
9785
9785
9786
- if (maxcount < 0 )
9787
- maxcount = PY_SSIZE_T_MAX ;
9786
+ len1 = PyUnicode_GET_LENGTH (self );
9787
+ kind1 = PyUnicode_KIND (self );
9788
+ if (maxcount < 0 ) {
9789
+ maxcount = len1 ;
9790
+ }
9788
9791
9789
9792
if (substring == NULL )
9790
- switch (PyUnicode_KIND ( self ) ) {
9793
+ switch (kind1 ) {
9791
9794
case PyUnicode_1BYTE_KIND :
9792
9795
if (PyUnicode_IS_ASCII (self ))
9793
9796
return asciilib_rsplit_whitespace (
9794
9797
self , PyUnicode_1BYTE_DATA (self ),
9795
- PyUnicode_GET_LENGTH ( self ) , maxcount
9798
+ len1 , maxcount
9796
9799
);
9797
9800
else
9798
9801
return ucs1lib_rsplit_whitespace (
9799
9802
self , PyUnicode_1BYTE_DATA (self ),
9800
- PyUnicode_GET_LENGTH ( self ) , maxcount
9803
+ len1 , maxcount
9801
9804
);
9802
9805
case PyUnicode_2BYTE_KIND :
9803
9806
return ucs2lib_rsplit_whitespace (
9804
9807
self , PyUnicode_2BYTE_DATA (self ),
9805
- PyUnicode_GET_LENGTH ( self ) , maxcount
9808
+ len1 , maxcount
9806
9809
);
9807
9810
case PyUnicode_4BYTE_KIND :
9808
9811
return ucs4lib_rsplit_whitespace (
9809
9812
self , PyUnicode_4BYTE_DATA (self ),
9810
- PyUnicode_GET_LENGTH ( self ) , maxcount
9813
+ len1 , maxcount
9811
9814
);
9812
9815
default :
9813
9816
Py_UNREACHABLE ();
9814
9817
}
9815
9818
9816
- kind1 = PyUnicode_KIND (self );
9817
9819
kind2 = PyUnicode_KIND (substring );
9818
- len1 = PyUnicode_GET_LENGTH (self );
9819
9820
len2 = PyUnicode_GET_LENGTH (substring );
9820
9821
if (kind1 < kind2 || len1 < len2 ) {
9821
9822
out = PyList_New (1 );
0 commit comments