Fix forward for Python bytearray.

We need to use the stable functions instead of the unsafe macros, as the latter are not part of the stable ABI.

PiperOrigin-RevId: 642679733
pull/17124/head
Joshua Haberman 8 months ago committed by Copybara-Service
parent 0d1e067640
commit 1f984453e8
  1. 4
      python/message.c

@ -1330,8 +1330,8 @@ PyObject* PyUpb_Message_MergeFromString(PyObject* _self, PyObject* arg) {
(void)err; (void)err;
assert(err >= 0); assert(err >= 0);
} else if (PyByteArray_Check(arg)) { } else if (PyByteArray_Check(arg)) {
buf = PyByteArray_AS_STRING(arg); buf = PyByteArray_AsString(arg);
size = PyByteArray_GET_SIZE(arg); size = PyByteArray_Size(arg);
} else if (PyBytes_AsStringAndSize(arg, &buf, &size) < 0) { } else if (PyBytes_AsStringAndSize(arg, &buf, &size) < 0) {
return NULL; return NULL;
} }

Loading…
Cancel
Save