@@ -521,13 +521,19 @@ typedef struct {
521521 unsigned char readonly ;
522522} _PyUnicodeWriter ;
523523
524+ #ifndef Py_BUILD_CORE
525+ # define _Py_PUBLIC_DEPRECATED (version ) Py_DEPRECATED(version)
526+ #else
527+ # define _Py_PUBLIC_DEPRECATED (version )
528+ #endif
529+
524530// Initialize a Unicode writer.
525531//
526532// By default, the minimum buffer size is 0 character and overallocation is
527533// disabled. Set min_length, min_char and overallocate attributes to control
528534// the allocation of the buffer.
529- PyAPI_FUNC (void )
530- _PyUnicodeWriter_Init ( _PyUnicodeWriter * writer );
535+ _Py_PUBLIC_DEPRECATED ( 3.14 ) PyAPI_FUNC (void ) _PyUnicodeWriter_Init (
536+ _PyUnicodeWriter * writer );
531537
532538/* Prepare the buffer to write 'length' characters
533539 with the specified maximum character.
@@ -543,9 +549,10 @@ _PyUnicodeWriter_Init(_PyUnicodeWriter *writer);
543549
544550/* Don't call this function directly, use the _PyUnicodeWriter_Prepare() macro
545551 instead. */
546- PyAPI_FUNC (int )
547- _PyUnicodeWriter_PrepareInternal (_PyUnicodeWriter * writer ,
548- Py_ssize_t length , Py_UCS4 maxchar );
552+ _Py_PUBLIC_DEPRECATED (3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_PrepareInternal (
553+ _PyUnicodeWriter * writer ,
554+ Py_ssize_t length ,
555+ Py_UCS4 maxchar );
549556
550557/* Prepare the buffer to have at least the kind KIND.
551558 For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will
@@ -559,58 +566,55 @@ _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
559566
560567/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind()
561568 macro instead. */
562- PyAPI_FUNC (int )
563- _PyUnicodeWriter_PrepareKindInternal ( _PyUnicodeWriter * writer ,
564- int kind );
569+ _Py_PUBLIC_DEPRECATED ( 3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_PrepareKindInternal (
570+ _PyUnicodeWriter * writer ,
571+ int kind );
565572
566573/* Append a Unicode character.
567574 Return 0 on success, raise an exception and return -1 on error. */
568- PyAPI_FUNC (int )
569- _PyUnicodeWriter_WriteChar (_PyUnicodeWriter * writer ,
570- Py_UCS4 ch
571- );
575+ _Py_PUBLIC_DEPRECATED (3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_WriteChar (
576+ _PyUnicodeWriter * writer ,
577+ Py_UCS4 ch );
572578
573579/* Append a Unicode string.
574580 Return 0 on success, raise an exception and return -1 on error. */
575- PyAPI_FUNC (int )
576- _PyUnicodeWriter_WriteStr (_PyUnicodeWriter * writer ,
577- PyObject * str /* Unicode string */
578- );
581+ _Py_PUBLIC_DEPRECATED (3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_WriteStr (
582+ _PyUnicodeWriter * writer ,
583+ PyObject * str ); /* Unicode string */
579584
580585/* Append a substring of a Unicode string.
581586 Return 0 on success, raise an exception and return -1 on error. */
582- PyAPI_FUNC (int )
583- _PyUnicodeWriter_WriteSubstring ( _PyUnicodeWriter * writer ,
587+ _Py_PUBLIC_DEPRECATED ( 3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_WriteSubstring (
588+ _PyUnicodeWriter * writer ,
584589 PyObject * str , /* Unicode string */
585590 Py_ssize_t start ,
586- Py_ssize_t end
587- );
591+ Py_ssize_t end );
588592
589593/* Append an ASCII-encoded byte string.
590594 Return 0 on success, raise an exception and return -1 on error. */
591- PyAPI_FUNC (int )
592- _PyUnicodeWriter_WriteASCIIString ( _PyUnicodeWriter * writer ,
595+ _Py_PUBLIC_DEPRECATED ( 3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_WriteASCIIString (
596+ _PyUnicodeWriter * writer ,
593597 const char * str , /* ASCII-encoded byte string */
594- Py_ssize_t len /* number of bytes, or -1 if unknown */
595- );
598+ Py_ssize_t len ); /* number of bytes, or -1 if unknown */
596599
597600/* Append a latin1-encoded byte string.
598601 Return 0 on success, raise an exception and return -1 on error. */
599- PyAPI_FUNC (int )
600- _PyUnicodeWriter_WriteLatin1String ( _PyUnicodeWriter * writer ,
602+ _Py_PUBLIC_DEPRECATED ( 3.14 ) PyAPI_FUNC (int ) _PyUnicodeWriter_WriteLatin1String (
603+ _PyUnicodeWriter * writer ,
601604 const char * str , /* latin1-encoded byte string */
602- Py_ssize_t len /* length in bytes */
603- );
605+ Py_ssize_t len ); /* length in bytes */
604606
605607/* Get the value of the writer as a Unicode string. Clear the
606608 buffer of the writer. Raise an exception and return NULL
607609 on error. */
608- PyAPI_FUNC (PyObject * )
609- _PyUnicodeWriter_Finish ( _PyUnicodeWriter * writer );
610+ _Py_PUBLIC_DEPRECATED ( 3.14 ) PyAPI_FUNC (PyObject * ) _PyUnicodeWriter_Finish (
611+ _PyUnicodeWriter * writer );
610612
611613/* Deallocate memory of a writer (clear its internal buffer). */
612- PyAPI_FUNC (void )
613- _PyUnicodeWriter_Dealloc (_PyUnicodeWriter * writer );
614+ _Py_PUBLIC_DEPRECATED (3.14 ) PyAPI_FUNC (void ) _PyUnicodeWriter_Dealloc (
615+ _PyUnicodeWriter * writer );
616+
617+ #undef _Py_PUBLIC_DEPRECATED
614618
615619
616620/* --- Manage the default encoding ---------------------------------------- */
0 commit comments