File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -913,9 +913,10 @@ time_strftime(PyObject *module, PyObject *args)
913
913
PyErr_NoMemory ();
914
914
return NULL ;
915
915
}
916
- _PyUnicodeWriter writer ;
917
- _PyUnicodeWriter_Init (& writer );
918
- writer .overallocate = 1 ;
916
+ PyUnicodeWriter * writer = PyUnicodeWriter_Create (0 );
917
+ if (writer == NULL ) {
918
+ goto error ;
919
+ }
919
920
Py_ssize_t i = 0 ;
920
921
while (i < format_size ) {
921
922
fmtlen = 0 ;
@@ -933,7 +934,7 @@ time_strftime(PyObject *module, PyObject *args)
933
934
if (unicode == NULL ) {
934
935
goto error ;
935
936
}
936
- if (_PyUnicodeWriter_WriteStr ( & writer , unicode ) < 0 ) {
937
+ if (PyUnicodeWriter_WriteStr ( writer , unicode ) < 0 ) {
937
938
Py_DECREF (unicode );
938
939
goto error ;
939
940
}
@@ -947,18 +948,18 @@ time_strftime(PyObject *module, PyObject *args)
947
948
break ;
948
949
}
949
950
}
950
- if (_PyUnicodeWriter_WriteSubstring ( & writer , format_arg , start , i ) < 0 ) {
951
+ if (PyUnicodeWriter_WriteSubstring ( writer , format_arg , start , i ) < 0 ) {
951
952
goto error ;
952
953
}
953
954
}
954
955
955
956
PyMem_Free (outbuf );
956
957
PyMem_Free (format );
957
- return _PyUnicodeWriter_Finish ( & writer );
958
+ return PyUnicodeWriter_Finish ( writer );
958
959
error :
959
960
PyMem_Free (outbuf );
960
961
PyMem_Free (format );
961
- _PyUnicodeWriter_Dealloc ( & writer );
962
+ PyUnicodeWriter_Discard ( writer );
962
963
return NULL ;
963
964
}
964
965
You can’t perform that action at this time.
0 commit comments