@@ -1810,7 +1810,7 @@ AK_CPL_to_array_unicode(AK_CodePointLine* cpl, PyArray_Descr* dtype)
1810
1810
// mutate the passed dtype as it is new and will be stolen in array construction
1811
1811
if (dtype -> elsize == 0 ) {
1812
1812
field_points = cpl -> offset_max ;
1813
- dtype -> elsize = field_points * sizeof (Py_UCS4 );
1813
+ dtype -> elsize = ( int )( field_points * sizeof (Py_UCS4 ) );
1814
1814
capped_points = false;
1815
1815
}
1816
1816
else {
@@ -1876,7 +1876,7 @@ AK_CPL_to_array_bytes(AK_CodePointLine* cpl, PyArray_Descr* dtype)
1876
1876
1877
1877
if (dtype -> elsize == 0 ) {
1878
1878
field_points = cpl -> offset_max ;
1879
- dtype -> elsize = field_points ;
1879
+ dtype -> elsize = ( int ) field_points ;
1880
1880
capped_points = false;
1881
1881
}
1882
1882
else {
@@ -2013,7 +2013,7 @@ AK_line_select_keep(
2013
2013
Py_ssize_t lookup_number )
2014
2014
{
2015
2015
if (axis_target && (line_select != NULL )) {
2016
- PyObject * number = PyLong_FromLong (lookup_number );
2016
+ PyObject * number = PyLong_FromSsize_t (lookup_number );
2017
2017
if (number == NULL ) return -1 ;
2018
2018
2019
2019
PyObject * keep = PyObject_CallFunctionObjArgs (
@@ -2114,7 +2114,7 @@ AK_CPG_resize(AK_CodePointGrid* cpg, Py_ssize_t line)
2114
2114
type_parse = true;
2115
2115
}
2116
2116
else {
2117
- PyObject * line_count = PyLong_FromLong (line );
2117
+ PyObject * line_count = PyLong_FromSsize_t (line );
2118
2118
if (line_count == NULL ) return -1 ;
2119
2119
2120
2120
PyObject * dtype_specifier = PyObject_CallFunctionObjArgs (
@@ -2210,7 +2210,7 @@ PyObject* AK_CPG_ToArrayList(AK_CodePointGrid* cpg,
2210
2210
2211
2211
if (dtypes != NULL ) {
2212
2212
// 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 );
2214
2214
if (line_count == NULL ) {
2215
2215
Py_DECREF (list );
2216
2216
return NULL ;
@@ -3236,9 +3236,9 @@ shape_filter(PyObject *Py_UNUSED(m), PyObject *a)
3236
3236
AK_CHECK_NUMPY_ARRAY_1D_2D (a );
3237
3237
PyArrayObject * array = (PyArrayObject * )a ;
3238
3238
3239
- int size0 = PyArray_DIM (array , 0 );
3239
+ npy_intp size0 = PyArray_DIM (array , 0 );
3240
3240
// 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 );
3242
3242
return Py_BuildValue ("ii" , size0 , size1 );
3243
3243
}
3244
3244
@@ -3388,14 +3388,14 @@ first_true_1d(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs)
3388
3388
}
3389
3389
3390
3390
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
3392
3392
3393
3393
npy_bool * array_buffer = (npy_bool * )PyArray_DATA (array );
3394
3394
3395
3395
NPY_BEGIN_THREADS_DEF ;
3396
3396
NPY_BEGIN_THREADS ;
3397
3397
3398
- npy_intp position = -1 ;
3398
+ Py_ssize_t position = -1 ;
3399
3399
npy_bool * p ;
3400
3400
npy_bool * p_end ;
3401
3401
@@ -3441,7 +3441,7 @@ first_true_1d(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs)
3441
3441
}
3442
3442
NPY_END_THREADS ;
3443
3443
3444
- PyObject * post = PyLong_FromLong (position );
3444
+ PyObject * post = PyLong_FromSsize_t (position );
3445
3445
return post ;
3446
3446
}
3447
3447
@@ -3996,7 +3996,7 @@ get_new_indexers_and_screen(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kw
3996
3996
NPY_BEGIN_THREADS ;
3997
3997
3998
3998
size_t i = 0 ;
3999
- npy_int64 num_found = 0 ;
3999
+ Py_ssize_t num_found = 0 ;
4000
4000
do {
4001
4001
// Get the inner loop data/stride/inner_size values
4002
4002
char * data = * dataptr ;
@@ -4036,7 +4036,10 @@ get_new_indexers_and_screen(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kw
4036
4036
Py_DECREF (element_locations );
4037
4037
4038
4038
// 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 );
4040
4043
Py_DECREF (order_found );
4041
4044
if (new_positions == NULL ) {
4042
4045
return NULL ;
0 commit comments