Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
gh-133546: Makere.Match
a well-roundedSequence
type#133549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
74480a7
a3de846
603b1d1
70b73e4
f51ef45
f218828
5272141
d0aa6fa
5f67be0
17feaa6
fe709f8
4095b52
51d918d
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2657,8 +2657,9 @@ _sre_SRE_Match_index_impl(MatchObject *self, PyObject *value, | ||
if (start < 0) { | ||
start += self->groups; | ||
if (start < 0) { | ||
start = 0; | ||
} | ||
} | ||
if (stop < 0) { | ||
stop += self->groups; | ||
@@ -2668,14 +2669,17 @@ _sre_SRE_Match_index_impl(MatchObject *self, PyObject *value, | ||
} | ||
for (i = start; i < stop; i++) { | ||
PyObject* group = match_getslice_by_index(self, i, Py_None); | ||
if (group == NULL) { | ||
return NULL; | ||
} | ||
int cmp = PyObject_RichCompareBool(group, value, Py_EQ); | ||
picnixz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
Py_DECREF(group); | ||
if (cmp > 0) { | ||
return PyLong_FromSsize_t(i); | ||
} | ||
else if (cmp < 0) { | ||
return NULL; | ||
} | ||
} | ||
PyErr_SetString(PyExc_ValueError, "match.index(x): x not in match"); | ||
picnixz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
return NULL; | ||
@@ -2699,14 +2703,17 @@ _sre_SRE_Match_count_impl(MatchObject *self, PyObject *value) | ||
for (i = 0; i < self->groups; i++) { | ||
PyObject* group = match_getslice_by_index(self, i, Py_None); | ||
if (group == NULL) { | ||
return NULL; | ||
} | ||
int cmp = PyObject_RichCompareBool(group, value, Py_EQ); | ||
Py_DECREF(group); | ||
if (cmp > 0) { | ||
picnixz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page.
vberlier marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
count++; | ||
} | ||
else if (cmp < 0) { | ||
return NULL; | ||
} | ||
} | ||
return PyLong_FromSsize_t(count); | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.