@@ -1810,7 +1810,7 @@ AK_CPL_to_array_unicode(AK_CodePointLine* cpl, PyArray_Descr* dtype)
18101810 // mutate the passed dtype as it is new and will be stolen in array construction
18111811 if (dtype -> elsize == 0 ) {
18121812 field_points = cpl -> offset_max ;
1813- dtype -> elsize = field_points * sizeof (Py_UCS4 );
1813+ dtype -> elsize = ( int )( field_points * sizeof (Py_UCS4 ) );
18141814 capped_points = false;
18151815 }
18161816 else {
@@ -1876,7 +1876,7 @@ AK_CPL_to_array_bytes(AK_CodePointLine* cpl, PyArray_Descr* dtype)
18761876
18771877 if (dtype -> elsize == 0 ) {
18781878 field_points = cpl -> offset_max ;
1879- dtype -> elsize = field_points ;
1879+ dtype -> elsize = ( int ) field_points ;
18801880 capped_points = false;
18811881 }
18821882 else {
@@ -2013,7 +2013,7 @@ AK_line_select_keep(
20132013 Py_ssize_t lookup_number )
20142014{
20152015 if (axis_target && (line_select != NULL )) {
2016- PyObject * number = PyLong_FromLong (lookup_number );
2016+ PyObject * number = PyLong_FromSsize_t (lookup_number );
20172017 if (number == NULL ) return -1 ;
20182018
20192019 PyObject * keep = PyObject_CallFunctionObjArgs (
@@ -2114,7 +2114,7 @@ AK_CPG_resize(AK_CodePointGrid* cpg, Py_ssize_t line)
21142114 type_parse = true;
21152115 }
21162116 else {
2117- PyObject * line_count = PyLong_FromLong (line );
2117+ PyObject * line_count = PyLong_FromSsize_t (line );
21182118 if (line_count == NULL ) return -1 ;
21192119
21202120 PyObject * dtype_specifier = PyObject_CallFunctionObjArgs (
@@ -2210,7 +2210,7 @@ PyObject* AK_CPG_ToArrayList(AK_CodePointGrid* cpg,
22102210
22112211 if (dtypes != NULL ) {
22122212 // NOTE: we call this with i regardless of if we skipped a line
2213- PyObject * line_count = PyLong_FromLong (i );
2213+ PyObject * line_count = PyLong_FromSsize_t (i );
22142214 if (line_count == NULL ) {
22152215 Py_DECREF (list );
22162216 return NULL ;
@@ -3236,9 +3236,9 @@ shape_filter(PyObject *Py_UNUSED(m), PyObject *a)
32363236 AK_CHECK_NUMPY_ARRAY_1D_2D (a );
32373237 PyArrayObject * array = (PyArrayObject * )a ;
32383238
3239- int size0 = PyArray_DIM (array , 0 );
3239+ npy_intp size0 = PyArray_DIM (array , 0 );
32403240 // If 1D array, set size for axis 1 at 1, else use 2D array to get the size of axis 1
3241- int size1 = PyArray_NDIM (array ) == 1 ? 1 : PyArray_DIM (array , 1 );
3241+ npy_intp size1 = PyArray_NDIM (array ) == 1 ? 1 : PyArray_DIM (array , 1 );
32423242 return Py_BuildValue ("ii" , size0 , size1 );
32433243}
32443244
@@ -3388,14 +3388,14 @@ first_true_1d(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs)
33883388 }
33893389
33903390 npy_intp size = PyArray_SIZE (array );
3391- ldiv_t size_div = ldiv (size , 4 ); // quot, rem
3391+ ldiv_t size_div = ldiv (( long ) size , 4 ); // quot, rem
33923392
33933393 npy_bool * array_buffer = (npy_bool * )PyArray_DATA (array );
33943394
33953395 NPY_BEGIN_THREADS_DEF ;
33963396 NPY_BEGIN_THREADS ;
33973397
3398- npy_intp position = -1 ;
3398+ Py_ssize_t position = -1 ;
33993399 npy_bool * p ;
34003400 npy_bool * p_end ;
34013401
@@ -3441,7 +3441,7 @@ first_true_1d(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs)
34413441 }
34423442 NPY_END_THREADS ;
34433443
3444- PyObject * post = PyLong_FromLong (position );
3444+ PyObject * post = PyLong_FromSsize_t (position );
34453445 return post ;
34463446}
34473447
@@ -3996,7 +3996,7 @@ get_new_indexers_and_screen(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kw
39963996 NPY_BEGIN_THREADS ;
39973997
39983998 size_t i = 0 ;
3999- npy_int64 num_found = 0 ;
3999+ Py_ssize_t num_found = 0 ;
40004000 do {
40014001 // Get the inner loop data/stride/inner_size values
40024002 char * data = * dataptr ;
@@ -4036,7 +4036,10 @@ get_new_indexers_and_screen(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kw
40364036 Py_DECREF (element_locations );
40374037
40384038 // new_positions = order_found[:num_unique]
4039- PyObject * new_positions = PySequence_GetSlice ((PyObject * )order_found , 0 , num_found );
4039+ PyObject * new_positions = PySequence_GetSlice (
4040+ (PyObject * )order_found ,
4041+ 0 ,
4042+ num_found );
40404043 Py_DECREF (order_found );
40414044 if (new_positions == NULL ) {
40424045 return NULL ;
0 commit comments