updated for version 7.3.942
Problem:    Python: SEGV in Buffer functions.
Solution:   Call CheckBuffer() at the right time. (ZyX)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index d8b0f70..681b7a1 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -2391,6 +2391,9 @@
     if (CheckBuffer(self))
 	return NULL;
 
+    if (end == -1)
+	end = self->buf->b_ml.ml_line_count;
+
     if (n < 0 || n > end - start)
     {
 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
@@ -2408,6 +2411,9 @@
     if (CheckBuffer(self))
 	return NULL;
 
+    if (end == -1)
+	end = self->buf->b_ml.ml_line_count;
+
     size = end - start + 1;
 
     if (lo < 0)
@@ -2432,6 +2438,9 @@
     if (CheckBuffer(self))
 	return -1;
 
+    if (end == -1)
+	end = self->buf->b_ml.ml_line_count;
+
     if (n < 0 || n > end - start)
     {
 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
@@ -2457,6 +2466,9 @@
     if (CheckBuffer(self))
 	return -1;
 
+    if (end == -1)
+	end = self->buf->b_ml.ml_line_count;
+
     /* Sort out the slice range */
     size = end - start + 1;
 
@@ -2493,6 +2505,9 @@
     if (CheckBuffer(self))
 	return NULL;
 
+    if (end == -1)
+	end = self->buf->b_ml.ml_line_count;
+
     max = n = end - start + 1;
 
     if (!PyArg_ParseTuple(args, "O|n", &lines, &n))
@@ -2700,15 +2715,13 @@
     static PyObject *
 BufferItem(PyObject *self, PyInt n)
 {
-    return RBItem((BufferObject *)(self), n, 1,
-		  (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count);
+    return RBItem((BufferObject *)(self), n, 1, -1);
 }
 
     static PyObject *
 BufferSlice(PyObject *self, PyInt lo, PyInt hi)
 {
-    return RBSlice((BufferObject *)(self), lo, hi, 1,
-		   (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count);
+    return RBSlice((BufferObject *)(self), lo, hi, 1, -1);
 }
 
     static PyObject *
@@ -2732,9 +2745,7 @@
     static PyObject *
 BufferAppend(PyObject *self, PyObject *args)
 {
-    return RBAppend((BufferObject *)(self), args, 1,
-		    (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
-		    NULL);
+    return RBAppend((BufferObject *)(self), args, 1, -1, NULL);
 }
 
     static PyObject *
diff --git a/src/if_python.c b/src/if_python.c
index 8e3621c..dda65af 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -1073,17 +1073,13 @@
     static PyInt
 BufferAssItem(PyObject *self, PyInt n, PyObject *val)
 {
-    return RBAsItem((BufferObject *)(self), n, val, 1,
-		     (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
-		     NULL);
+    return RBAsItem((BufferObject *)(self), n, val, 1, -1, NULL);
 }
 
     static PyInt
 BufferAssSlice(PyObject *self, PyInt lo, PyInt hi, PyObject *val)
 {
-    return RBAsSlice((BufferObject *)(self), lo, hi, val, 1,
-		      (PyInt)((BufferObject *)(self))->buf->b_ml.ml_line_count,
-		      NULL);
+    return RBAsSlice((BufferObject *)(self), lo, hi, val, 1, -1, NULL);
 }
 
 static PySequenceMethods RangeAsSeq = {
diff --git a/src/if_python3.c b/src/if_python3.c
index 77d7cd3..da0867b 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -1110,6 +1110,9 @@
     {
 	Py_ssize_t start, stop, step, slicelen;
 
+	if (CheckBuffer((BufferObject *) self))
+	    return NULL;
+
 	if (PySlice_GetIndicesEx((PyObject *)idx,
 	      (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1,
 	      &start, &stop,
@@ -1139,6 +1142,9 @@
     {
 	Py_ssize_t start, stop, step, slicelen;
 
+	if (CheckBuffer((BufferObject *) self))
+	    return -1;
+
 	if (PySlice_GetIndicesEx((PyObject *)idx,
 	      (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1,
 	      &start, &stop,
diff --git a/src/version.c b/src/version.c
index 8bc257f..be2138c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    942,
+/**/
     941,
 /**/
     940,