summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2024-03-06 19:30:11 (GMT)
committerGitHub <noreply@github.com>2024-03-06 19:30:11 (GMT)
commit7114cf20c015b99123b32c1ba4f5475b7a6c3a13 (patch)
tree1c5392c31ac5d921cfb0b5856ff2df66cdfd4682 /Objects
parent73807eb634315f70a464a18feaae33d9e065de09 (diff)
downloadcpython-7114cf20c015b99123b32c1ba4f5475b7a6c3a13.zip
cpython-7114cf20c015b99123b32c1ba4f5475b7a6c3a13.tar.gz
cpython-7114cf20c015b99123b32c1ba4f5475b7a6c3a13.tar.bz2
gh-116381: Specialize CONTAINS_OP (GH-116385)
* Specialize CONTAINS_OP * 📜🤖 Added by blurb_it. * Add PyAPI_FUNC for JIT --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c6
-rw-r--r--Objects/setobject.c8
-rw-r--r--Objects/tupleobject.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index e013383..db8eedf 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -524,8 +524,8 @@ list_length(PyObject *a)
return PyList_GET_SIZE(a);
}
-static int
-list_contains(PyObject *aa, PyObject *el)
+int
+_PyList_Contains(PyObject *aa, PyObject *el)
{
for (Py_ssize_t i = 0; ; i++) {
@@ -3147,7 +3147,7 @@ static PySequenceMethods list_as_sequence = {
0, /* sq_slice */
list_ass_item, /* sq_ass_item */
0, /* sq_ass_slice */
- list_contains, /* sq_contains */
+ _PyList_Contains, /* sq_contains */
list_inplace_concat, /* sq_inplace_concat */
list_inplace_repeat, /* sq_inplace_repeat */
};
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 6a4c8c4..b4d803c 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1987,8 +1987,8 @@ set_add(PySetObject *so, PyObject *key)
Py_RETURN_NONE;
}
-static int
-set_contains(PySetObject *so, PyObject *key)
+int
+_PySet_Contains(PySetObject *so, PyObject *key)
{
PyObject *tmpkey;
int rv;
@@ -2023,7 +2023,7 @@ set___contains__(PySetObject *so, PyObject *key)
{
long result;
- result = set_contains(so, key);
+ result = _PySet_Contains(so, key);
if (result < 0)
return NULL;
return PyBool_FromLong(result);
@@ -2198,7 +2198,7 @@ static PySequenceMethods set_as_sequence = {
0, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
- (objobjproc)set_contains, /* sq_contains */
+ (objobjproc)_PySet_Contains, /* sq_contains */
};
/* set object ********************************************************/
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index d9dc00d..5bbc027 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -349,8 +349,8 @@ tuplelength(PyTupleObject *a)
return Py_SIZE(a);
}
-static int
-tuplecontains(PyTupleObject *a, PyObject *el)
+int
+_PyTuple_Contains(PyTupleObject *a, PyObject *el)
{
Py_ssize_t i;
int cmp;
@@ -758,7 +758,7 @@ static PySequenceMethods tuple_as_sequence = {
0, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
- (objobjproc)tuplecontains, /* sq_contains */
+ (objobjproc)_PyTuple_Contains, /* sq_contains */
};
static PyObject*