- if (PyObject_AsReadBuffer(x, &xv, &xsz) ||
- PyObject_AsReadBuffer(y, &yv, &ysz))
- goto end;
- zsz = (size_t)xsz + (size_t)ysz;
- if (xsz < 0 || ysz < 0 || zsz < xsz) VALERR("too long");
- z = bytestring_pywrap(0, zsz); zp = PyString_AS_STRING(z);
- memcpy(zp, xv, xsz); memcpy(zp + xsz, yv, ysz);
+ if (!convbin(x, &xx) || !convbin(y, &yy)) goto end;
+ zsz = (size_t)xx.sz + (size_t)yy.sz;
+ if (xx.sz < 0 || yy.sz < 0 || zsz < xx.sz) VALERR("too long");
+ z = bytestring_pywrap(0, zsz); zp = BIN_PTR(z);
+ memcpy(zp, xx.p, xx.sz); memcpy(zp + xx.sz, yy.p, yy.sz);