@@ -1069,7 +1069,7 @@ AK_CPL_Free(AK_CodePointLine* cpl)
1069
1069
PyMem_Free (cpl -> buffer );
1070
1070
PyMem_Free (cpl -> offsets );
1071
1071
if (cpl -> type_parser ) {
1072
- PyMem_Free (cpl -> type_parser );
1072
+ AK_TP_Free (cpl -> type_parser );
1073
1073
}
1074
1074
PyMem_Free (cpl );
1075
1075
}
@@ -1364,7 +1364,7 @@ AK_CPL_to_array_float(AK_CodePointLine* cpl, PyArray_Descr* dtype, char tsep, ch
1364
1364
// initialize error code to 0; only update on error.
1365
1365
int error = 0 ;
1366
1366
bool matched_elsize = true;
1367
- int elsize = dtype -> elsize ;
1367
+ int elsize = PyDataType_ELSIZE ( dtype ) ;
1368
1368
1369
1369
NPY_BEGIN_THREADS_DEF ;
1370
1370
NPY_BEGIN_THREADS ;
@@ -1442,7 +1442,7 @@ AK_CPL_to_array_int(AK_CodePointLine* cpl, PyArray_Descr* dtype, char tsep)
1442
1442
// initialize error code to 0; only update on error.
1443
1443
int error = 0 ;
1444
1444
bool matched_elsize = true;
1445
- int elsize = dtype -> elsize ;
1445
+ int elsize = PyDataType_ELSIZE ( dtype ) ;
1446
1446
1447
1447
NPY_BEGIN_THREADS_DEF ;
1448
1448
NPY_BEGIN_THREADS ;
@@ -1515,7 +1515,7 @@ AK_CPL_to_array_uint(AK_CodePointLine* cpl, PyArray_Descr* dtype, char tsep)
1515
1515
// initialize error code to 0; only update on error.
1516
1516
int error = 0 ;
1517
1517
bool matched_elsize = true;
1518
- int elsize = dtype -> elsize ;
1518
+ int elsize = PyDataType_ELSIZE ( dtype ) ;
1519
1519
1520
1520
NPY_BEGIN_THREADS_DEF ;
1521
1521
NPY_BEGIN_THREADS ;
@@ -1583,15 +1583,15 @@ AK_CPL_to_array_unicode(AK_CodePointLine* cpl, PyArray_Descr* dtype)
1583
1583
bool capped_points ;
1584
1584
1585
1585
// 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 ) {
1587
1587
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 ));
1589
1590
capped_points = false;
1590
1591
}
1591
1592
else {
1592
1593
// 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 ;
1595
1595
capped_points = true;
1596
1596
}
1597
1597
@@ -1649,13 +1649,14 @@ AK_CPL_to_array_bytes(AK_CodePointLine* cpl, PyArray_Descr* dtype)
1649
1649
Py_ssize_t field_points ;
1650
1650
bool capped_points ;
1651
1651
1652
- if (dtype -> elsize == 0 ) {
1652
+ if (PyDataType_ELSIZE ( dtype ) == 0 ) {
1653
1653
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 );
1655
1656
capped_points = false;
1656
1657
}
1657
1658
else {
1658
- field_points = dtype -> elsize ;
1659
+ field_points = PyDataType_ELSIZE ( dtype ) ;
1659
1660
capped_points = true;
1660
1661
}
1661
1662
0 commit comments