diff Objects/bytesobject.c @ 43632:0067a6ab4854

Issue 1267, continued. Additional patch by Christian Heimes to deal more cleanly with the FILE* vs file-descriptor issues. I cleaned up his code a bit, and moved the lseek() call into import.c.
author Guido van Rossum <guido@python.org>
date Mon, 22 Oct 2007 00:09:51 +0000
parents 697cc31a83f6
children 6ab64f6b4c03
line wrap: on
line diff
--- a/Objects/bytesobject.c	Sun Oct 21 02:45:33 2007 +0000
+++ b/Objects/bytesobject.c	Mon Oct 22 00:09:51 2007 +0000
@@ -1214,7 +1214,7 @@
     Py_ssize_t len = PyBytes_GET_SIZE(self);
     const char* str;
     Py_buffer vsubstr;
-    int rv;
+    int rv = 0;
 
     str = PyBytes_AS_STRING(self);
 
@@ -1226,13 +1226,11 @@
     if (direction < 0) {
         /* startswith */
         if (start+vsubstr.len > len) {
-            rv = 0;
             goto done;
         }
     } else {
         /* endswith */
         if (end-start < vsubstr.len || start > len) {
-            rv = 0;
             goto done;
         }