Cpython v3.12 removed PyUnicode_AsUnicode

Hi,

We have upgrading cpython to v3.12. I have noticed PyUnicode_AsUnicode have been deprecated. I don’t find equivalent replacement for PyUnicode_AsUnicode in the documentation.
Does anyone know what would be the replacement of PyUnicode_AsUnicode in v3.12?

Maybe PyUnicode_AsUnicodeEscapeString?

Also, you might find PyUnicode_AsUnicode in earlier (3.10, 3.11) documentation with a brief explanation of how to replace it in existing code.

Py_UNICODE *PyUnicode_AsUnicode(PyObject *unicode)

[…]

Deprecated since version 3.3, will be removed in version 3.12: Part of the old-style Unicode API, please migrate to using PyUnicode_AsUCS4(), PyUnicode_AsWideChar(), PyUnicode_ReadChar() or similar new APIs.
- Unicode Objects and Codecs — Python 3.11.8 documentation

Do any of these functions satisfy your needs?

Let the try and see. I think these will be helpful. Thanks.

PyUnicode_AsWideCharString works for me.