Make cStringIO.truncate raise IOError for negative
arguments (even for -1). Fixes the last bit of
#1359365.
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 100891b..3f762b0 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -289,7 +289,17 @@
 	
         if (!IO__opencheck(self)) return NULL;
         if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) return NULL;
-        if (pos < 0) pos = self->pos;
+
+	if (PyTuple_Size(args) == 0) {
+		/* No argument passed, truncate to current position */
+		pos = self->pos;
+	}
+
+        if (pos < 0) {
+		errno = EINVAL;
+		PyErr_SetFromErrno(PyExc_IOError);
+		return NULL;
+	}
 
         if (self->string_size > pos) self->string_size = pos;
         self->pos = self->string_size;