summaryrefslogtreecommitdiff
path: root/bindings/python/upb.c
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/python/upb.c')
-rw-r--r--bindings/python/upb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bindings/python/upb.c b/bindings/python/upb.c
index 497074b..8f36f70 100644
--- a/bindings/python/upb.c
+++ b/bindings/python/upb.c
@@ -612,8 +612,9 @@ static upb_sflow_t PyUpb_Message_StartRepeatedSubmessage(void *a, upb_value fval
static upb_flow_t PyUpb_Message_StringValue(void *m, upb_value fval, upb_value val) {
PyObject **str = PyUpb_Accessor_GetPtr(m, fval);
if (*str) { Py_DECREF(*str); }
- *str = PyString_FromStringAndSize(NULL, upb_value_getstrref(val)->len);
- upb_strref_read(upb_value_getstrref(val), PyString_AsString(*str));
+ upb_byteregion *r = upb_value_getbyteregion(val);
+ *str = PyString_FromStringAndSize(NULL, upb_byteregion_len(r));
+ upb_byteregion_copyall(r, PyString_AsString(*str));
upb_stdmsg_sethas(m, fval);
return UPB_CONTINUE;
}
@@ -621,8 +622,9 @@ static upb_flow_t PyUpb_Message_StringValue(void *m, upb_value fval, upb_value v
static upb_flow_t PyUpb_Message_AppendStringValue(void *a, upb_value fval, upb_value val) {
(void)fval;
PyObject **elem = upb_stdarray_append(a, sizeof(void*));
- *elem = PyString_FromStringAndSize(NULL, upb_value_getstrref(val)->len);
- upb_strref_read(upb_value_getstrref(val), PyString_AsString(*elem));
+ upb_byteregion *r = upb_value_getbyteregion(val);
+ *elem = PyString_FromStringAndSize(NULL, upb_byteregion_len(r));
+ upb_byteregion_copyall(r, PyString_AsString(*elem));
return UPB_CONTINUE;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback