bpo-35059: Cast void* to PyObject* (GH-10650)
Don't pass void* to Python macros: use _PyObject_CAST().
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index d22b277..01049f5 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1171,14 +1171,17 @@
#ifdef Py_DEBUG
/* Functions wrapping macros for use in debugger */
-char *_PyUnicode_utf8(void *unicode){
+char *_PyUnicode_utf8(void *unicode_raw){
+ PyObject *unicode = _PyObject_CAST(unicode_raw);
return PyUnicode_UTF8(unicode);
}
-void *_PyUnicode_compact_data(void *unicode) {
+void *_PyUnicode_compact_data(void *unicode_raw) {
+ PyObject *unicode = _PyObject_CAST(unicode_raw);
return _PyUnicode_COMPACT_DATA(unicode);
}
-void *_PyUnicode_data(void *unicode){
+void *_PyUnicode_data(void *unicode_raw) {
+ PyObject *unicode = _PyObject_CAST(unicode_raw);
printf("obj %p\n", unicode);
printf("compact %d\n", PyUnicode_IS_COMPACT(unicode));
printf("compact ascii %d\n", PyUnicode_IS_COMPACT_ASCII(unicode));