@@ -209,8 +209,8 @@ unicode_to_string(PyArrayMethod_Context *context, char *const data[],
209209 }
210210 npy_static_string * out_ss = (npy_static_string * )out ;
211211 npy_string_free (out_ss );
212- if (npy_string_newemptylen (out_num_bytes , out_ss ) < 0 ) {
213- gil_error (PyExc_MemoryError , "npy_string_newemptylen failed" );
212+ if (npy_string_newemptysize (out_num_bytes , out_ss ) < 0 ) {
213+ gil_error (PyExc_MemoryError , "npy_string_newemptysize failed" );
214214 return -1 ;
215215 }
216216 char * out_buf = out_ss -> buf ;
@@ -342,16 +342,16 @@ string_to_unicode(PyArrayMethod_Context *context, char *const data[],
342342 if (has_null && !has_string_na ) {
343343 // lossy but not much else we can do
344344 this_string = (unsigned char * )descr -> na_name .buf ;
345- n_bytes = descr -> na_name .len ;
345+ n_bytes = descr -> na_name .size ;
346346 }
347347 else {
348348 this_string = (unsigned char * )(default_string .buf );
349- n_bytes = default_string .len ;
349+ n_bytes = default_string .size ;
350350 }
351351 }
352352 else {
353353 this_string = (unsigned char * )(s -> buf );
354- n_bytes = s -> len ;
354+ n_bytes = s -> size ;
355355 }
356356 size_t tot_n_bytes = 0 ;
357357
@@ -440,10 +440,10 @@ string_to_bool(PyArrayMethod_Context *context, char *const data[],
440440 * out = (npy_bool )1 ;
441441 }
442442 else {
443- * out = (npy_bool )(default_string .len == 0 );
443+ * out = (npy_bool )(default_string .size == 0 );
444444 }
445445 }
446- else if (s -> len == 0 ) {
446+ else if (s -> size == 0 ) {
447447 * out = (npy_bool )0 ;
448448 }
449449 else {
@@ -482,14 +482,14 @@ bool_to_string(PyArrayMethod_Context *NPY_UNUSED(context), char *const data[],
482482 npy_static_string * out_ss = (npy_static_string * )out ;
483483 npy_string_free (out_ss );
484484 if ((npy_bool )(* in ) == 1 ) {
485- if (npy_string_newlen ("True" , 4 , out_ss ) < 0 ) {
486- gil_error (PyExc_MemoryError , "npy_string_newlen failed" );
485+ if (npy_string_newsize ("True" , 4 , out_ss ) < 0 ) {
486+ gil_error (PyExc_MemoryError , "npy_string_newsize failed" );
487487 return -1 ;
488488 }
489489 }
490490 else if ((npy_bool )(* in ) == 0 ) {
491- if (npy_string_newlen ("False" , 5 , out_ss ) < 0 ) {
492- gil_error (PyExc_MemoryError , "npy_string_newlen failed" );
491+ if (npy_string_newsize ("False" , 5 , out_ss ) < 0 ) {
492+ gil_error (PyExc_MemoryError , "npy_string_newsize failed" );
493493 return -1 ;
494494 }
495495 }
@@ -527,7 +527,7 @@ string_to_pylong(char *in, int hasnull)
527527 }
528528 s = & EMPTY_STRING ;
529529 }
530- PyObject * val_obj = PyUnicode_FromStringAndSize (s -> buf , s -> len );
530+ PyObject * val_obj = PyUnicode_FromStringAndSize (s -> buf , s -> size );
531531 if (val_obj == NULL ) {
532532 return NULL ;
533533 }
@@ -587,8 +587,8 @@ pyobj_to_string(PyObject *obj, char *out)
587587 }
588588 npy_static_string * out_ss = (npy_static_string * )out ;
589589 npy_string_free (out_ss );
590- if (npy_string_newlen (cstr_val , length , out_ss ) < 0 ) {
591- PyErr_SetString (PyExc_MemoryError , "npy_string_newlen failed" );
590+ if (npy_string_newsize (cstr_val , length , out_ss ) < 0 ) {
591+ PyErr_SetString (PyExc_MemoryError , "npy_string_newsize failed" );
592592 Py_DECREF (pystr_val );
593593 return -1 ;
594594 }
@@ -779,7 +779,7 @@ string_to_pyfloat(char *in, int hasnull)
779779 }
780780 s = & EMPTY_STRING ;
781781 }
782- PyObject * val_obj = PyUnicode_FromStringAndSize (s -> buf , s -> len );
782+ PyObject * val_obj = PyUnicode_FromStringAndSize (s -> buf , s -> size );
783783 if (val_obj == NULL ) {
784784 return NULL ;
785785 }
@@ -1004,7 +1004,7 @@ string_to_datetime(PyArrayMethod_Context *context, char *const data[],
10041004 s = & default_string ;
10051005 }
10061006 if (NpyDatetime_ParseISO8601Datetime (
1007- (const char * )s -> buf , s -> len , in_unit , NPY_UNSAFE_CASTING ,
1007+ (const char * )s -> buf , s -> size , in_unit , NPY_UNSAFE_CASTING ,
10081008 & dts , & in_meta .base , & out_special ) < 0 ) {
10091009 return -1 ;
10101010 }
@@ -1072,9 +1072,10 @@ datetime_to_string(PyArrayMethod_Context *context, char *const data[],
10721072 return -1 ;
10731073 }
10741074
1075- if (npy_string_newlen (datetime_buf , strlen (datetime_buf ), out_ss ) <
1076- 0 ) {
1077- PyErr_SetString (PyExc_MemoryError , "npy_string_newlen failed" );
1075+ if (npy_string_newsize (datetime_buf , strlen (datetime_buf ),
1076+ out_ss ) < 0 ) {
1077+ PyErr_SetString (PyExc_MemoryError ,
1078+ "npy_string_newsize failed" );
10781079 return -1 ;
10791080 }
10801081 }
0 commit comments