mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
c2954e5273
commit
40d20bcf1f
12 changed files with 94 additions and 64 deletions
|
|
@ -1214,7 +1214,7 @@ _bytes_tailmatch(PyBytesObject *self, PyObject *substr, Py_ssize_t start,
|
|||
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 @@ _bytes_tailmatch(PyBytesObject *self, PyObject *substr, Py_ssize_t start,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue