Fix (unreported) path_resolve returns string instead of bytes for bytes idprops.

The following code in py console would return a python string object,
instead of the expected bytes one.

```python
value = b"Hello World"
key = "a"
C.object[key] = value
C.object[key]
>>> b"Hello World"
C.object.path_resolve('["%s"]' % key)
>>> "Hello World"
```

Now it will return a byte object as it should.

Found while investigating #122843 .
This commit is contained in:
Bastien Montagne
2024-06-10 14:07:09 +02:00
parent 554b3c5bd9
commit 17332da834

View File

@@ -1157,6 +1157,10 @@ PropertySubType RNA_property_subtype(PropertyRNA *prop)
if (prop->magic != RNA_MAGIC) {
IDProperty *idprop = (IDProperty *)prop;
if (idprop->type == IDP_STRING && idprop->subtype == IDP_STRING_SUB_BYTE) {
return PROP_BYTESTRING;
}
if (idprop->ui_data) {
IDPropertyUIData *ui_data = idprop->ui_data;
return (PropertySubType)ui_data->rna_subtype;