diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-26 13:02:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-26 13:02:43 (GMT) |
commit | 6200aaf2967de420a2d83236008787c9f791561d (patch) | |
tree | d11be64f41c498889e8015eda64360b831e1c335 /Include/internal/pycore_abstract.h | |
parent | c075a1974b0dce9801cb645c77faa8af612b3db5 (diff) | |
download | cpython-6200aaf2967de420a2d83236008787c9f791561d.zip cpython-6200aaf2967de420a2d83236008787c9f791561d.tar.gz cpython-6200aaf2967de420a2d83236008787c9f791561d.tar.bz2 |
gh-106084: Remove _PyObject_HasLen() function (#106103)
Remove _PyObject_HasLen() and _PySequence_IterSearch() functions from
the public C API: move them to the internal C API
(pycore_abstract.h).
No longer export these symbols (in libpython).
Remove also unused pycore_initconfig.h include in typeobject.c.
Diffstat (limited to 'Include/internal/pycore_abstract.h')
-rw-r--r-- | Include/internal/pycore_abstract.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Include/internal/pycore_abstract.h b/Include/internal/pycore_abstract.h index b1afb2d..9ba2748 100644 --- a/Include/internal/pycore_abstract.h +++ b/Include/internal/pycore_abstract.h @@ -19,6 +19,28 @@ _PyIndex_Check(PyObject *obj) PyObject *_PyNumber_PowerNoMod(PyObject *lhs, PyObject *rhs); PyObject *_PyNumber_InPlacePowerNoMod(PyObject *lhs, PyObject *rhs); +extern int _PyObject_HasLen(PyObject *o); + +/* === Sequence protocol ================================================ */ + +#define PY_ITERSEARCH_COUNT 1 +#define PY_ITERSEARCH_INDEX 2 +#define PY_ITERSEARCH_CONTAINS 3 + +/* Iterate over seq. + + Result depends on the operation: + + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. */ +extern Py_ssize_t _PySequence_IterSearch(PyObject *seq, + PyObject *obj, int operation); + #ifdef __cplusplus } #endif |