How to create a str in a python limited abi extension

I’m trying to convert a simple extension to use the limited abi; currently I have this code

PyObject *result;
uint32_t *data;
.......
result = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND,(void*)data, length);

but this fails because PyUnicode_FromKindAndData, PyUnicode_4BYTE_KIND are not available in the LIMITED ABI.

I think this can be changed to

result = <unknown>; /*PyUnicode_New(length,(Py_UCS4)1114111);*/
for(i=0, i<length; i++) for(i=0;i<length;i++){
    PyUnicode_WriteChar(result,i,logical[i]);
    }

but PyUnicode_New is not in the LIMITED ABI

how can I create a unicode object in the LIMITED ABI? For that matter how can one create a float or an int etc etc?

Probably PyUnicode_Decode or PyUnicode_DecodeUTF32. Essentially you’re saying these are arbitrary bytes to be interpreted as utf32.

Yes I think that works. Thanks.