X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/blobdiff_plain/11cb3d97caae1888a6d6ae63ff6e2dea9f7cce01..f368b46e168e8accdb0c578ccbba7e7d2ee8c0de:/buffer.c diff --git a/buffer.c b/buffer.c index 8e4ece5..7456a3d 100644 --- a/buffer.c +++ b/buffer.c @@ -83,7 +83,7 @@ static int rbuf_pysegcount(PyObject *me, int *nn) { if (nn) *nn = BSZ(BUF_B(me)); return (1); } static int rbuf_pyreadbuf(PyObject *me, int seg, void **q) - { assert(seg == 0); *q = BBASE(BUF_B(me)); return (BSZ(BUF_B(me))); } + { assert(seg == 0); *q = BCUR(BUF_B(me)); return (BLEFT(BUF_B(me))); } static PyObject *rbmeth_skip(PyObject *me, PyObject *arg) { @@ -236,6 +236,7 @@ static PyObject *rbget_offset(PyObject *me, void *hunoz) static int rbset_offset(PyObject *me, PyObject *x, void *hunoz) { size_t n; + if (!x) NIERR("__del__"); if (!convszt(x, &n)) goto end; if (n > BSZ(BUF_B(me))) VALERR("out of range"); BCUR(BUF_B(me)) = BBASE(BUF_B(me)) + n;