@@ -1069,7 +1069,7 @@ AK_CPL_Free(AK_CodePointLine* cpl)
10691069 PyMem_Free (cpl -> buffer );
10701070 PyMem_Free (cpl -> offsets );
10711071 if (cpl -> type_parser ) {
1072- PyMem_Free (cpl -> type_parser );
1072+ AK_TP_Free (cpl -> type_parser );
10731073 }
10741074 PyMem_Free (cpl );
10751075}
@@ -1364,7 +1364,7 @@ AK_CPL_to_array_float(AK_CodePointLine* cpl, PyArray_Descr* dtype, char tsep, ch
13641364 // initialize error code to 0; only update on error.
13651365 int error = 0 ;
13661366 bool matched_elsize = true;
1367- int elsize = dtype -> elsize ;
1367+ int elsize = PyDataType_ELSIZE ( dtype ) ;
13681368
13691369 NPY_BEGIN_THREADS_DEF ;
13701370 NPY_BEGIN_THREADS ;
@@ -1442,7 +1442,7 @@ AK_CPL_to_array_int(AK_CodePointLine* cpl, PyArray_Descr* dtype, char tsep)
14421442 // initialize error code to 0; only update on error.
14431443 int error = 0 ;
14441444 bool matched_elsize = true;
1445- int elsize = dtype -> elsize ;
1445+ int elsize = PyDataType_ELSIZE ( dtype ) ;
14461446
14471447 NPY_BEGIN_THREADS_DEF ;
14481448 NPY_BEGIN_THREADS ;
@@ -1515,7 +1515,7 @@ AK_CPL_to_array_uint(AK_CodePointLine* cpl, PyArray_Descr* dtype, char tsep)
15151515 // initialize error code to 0; only update on error.
15161516 int error = 0 ;
15171517 bool matched_elsize = true;
1518- int elsize = dtype -> elsize ;
1518+ int elsize = PyDataType_ELSIZE ( dtype ) ;
15191519
15201520 NPY_BEGIN_THREADS_DEF ;
15211521 NPY_BEGIN_THREADS ;
@@ -1583,15 +1583,15 @@ AK_CPL_to_array_unicode(AK_CodePointLine* cpl, PyArray_Descr* dtype)
15831583 bool capped_points ;
15841584
15851585 // mutate the passed dtype as it is new and will be stolen in array construction
1586- if (dtype -> elsize == 0 ) {
1586+ if (PyDataType_ELSIZE ( dtype ) == 0 ) {
15871587 field_points = cpl -> offset_max ;
1588- dtype -> elsize = (int )(field_points * UCS4_SIZE );
1588+ // dtype->elsize = (int)(field_points * UCS4_SIZE);
1589+ PyDataType_SET_ELSIZE (dtype , (npy_intp )(field_points * UCS4_SIZE ));
15891590 capped_points = false;
15901591 }
15911592 else {
15921593 // assume that elsize is already given in units of 4
1593- // assert(dtype->elsize % UCS4_SIZE == 0);
1594- field_points = dtype -> elsize / UCS4_SIZE ;
1594+ field_points = PyDataType_ELSIZE (dtype ) / UCS4_SIZE ;
15951595 capped_points = true;
15961596 }
15971597
@@ -1649,13 +1649,14 @@ AK_CPL_to_array_bytes(AK_CodePointLine* cpl, PyArray_Descr* dtype)
16491649 Py_ssize_t field_points ;
16501650 bool capped_points ;
16511651
1652- if (dtype -> elsize == 0 ) {
1652+ if (PyDataType_ELSIZE ( dtype ) == 0 ) {
16531653 field_points = cpl -> offset_max ;
1654- dtype -> elsize = (int )field_points ;
1654+ // dtype->elsize = (int)field_points;
1655+ PyDataType_SET_ELSIZE (dtype , (npy_intp )field_points );
16551656 capped_points = false;
16561657 }
16571658 else {
1658- field_points = dtype -> elsize ;
1659+ field_points = PyDataType_ELSIZE ( dtype ) ;
16591660 capped_points = true;
16601661 }
16611662
0 commit comments