File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 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)
913913 PyErr_NoMemory ();
914914 return NULL ;
915915 }
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+ }
919920 Py_ssize_t i = 0 ;
920921 while (i < format_size ) {
921922 fmtlen = 0 ;
@@ -933,7 +934,7 @@ time_strftime(PyObject *module, PyObject *args)
933934 if (unicode == NULL ) {
934935 goto error ;
935936 }
936- if (_PyUnicodeWriter_WriteStr ( & writer , unicode ) < 0 ) {
937+ if (PyUnicodeWriter_WriteStr ( writer , unicode ) < 0 ) {
937938 Py_DECREF (unicode );
938939 goto error ;
939940 }
@@ -947,18 +948,18 @@ time_strftime(PyObject *module, PyObject *args)
947948 break ;
948949 }
949950 }
950- if (_PyUnicodeWriter_WriteSubstring ( & writer , format_arg , start , i ) < 0 ) {
951+ if (PyUnicodeWriter_WriteSubstring ( writer , format_arg , start , i ) < 0 ) {
951952 goto error ;
952953 }
953954 }
954955
955956 PyMem_Free (outbuf );
956957 PyMem_Free (format );
957- return _PyUnicodeWriter_Finish ( & writer );
958+ return PyUnicodeWriter_Finish ( writer );
958959error :
959960 PyMem_Free (outbuf );
960961 PyMem_Free (format );
961- _PyUnicodeWriter_Dealloc ( & writer );
962+ PyUnicodeWriter_Discard ( writer );
962963 return NULL ;
963964}
964965
You can’t perform that action at this time.
0 commit comments