codekingpro/portable-devtools
114k
1#ifndef Py_INTERNAL_ABSTRACT_H2#define Py_INTERNAL_ABSTRACT_H3#ifdef __cplusplus4extern "C" {5#endif6 7#ifndef Py_BUILD_CORE8# error "this header requires Py_BUILD_CORE define"9#endif10 11// Fast inlined version of PyIndex_Check()12static inline int13_PyIndex_Check(PyObject *obj)14{15 PyNumberMethods *tp_as_number = Py_TYPE(obj)->tp_as_number;16 return (tp_as_number != NULL && tp_as_number->nb_index != NULL);17}18 19PyObject *_PyNumber_PowerNoMod(PyObject *lhs, PyObject *rhs);20PyObject *_PyNumber_InPlacePowerNoMod(PyObject *lhs, PyObject *rhs);21 22extern int _PyObject_HasLen(PyObject *o);23 24/* === Sequence protocol ================================================ */25 26#define PY_ITERSEARCH_COUNT 127#define PY_ITERSEARCH_INDEX 228#define PY_ITERSEARCH_CONTAINS 329 30/* Iterate over seq.31 32 Result depends on the operation:33 34 PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if35 error.36 PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of37 obj in seq; set ValueError and return -1 if none found;38 also return -1 on error.39 PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on40 error. */41extern Py_ssize_t _PySequence_IterSearch(PyObject *seq,42 PyObject *obj, int operation);43 44/* === Mapping protocol ================================================= */45 46extern int _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);47 48extern int _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);49 50// Convert Python int to Py_ssize_t. Do nothing if the argument is None.51// Export for '_bisect' shared extension.52PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);53 54// Same as PyNumber_Index() but can return an instance of a subclass of int.55// Export for 'math' shared extension.56PyAPI_FUNC(PyObject*) _PyNumber_Index(PyObject *o);57 58#ifdef __cplusplus59}60#endif61#endif /* !Py_INTERNAL_ABSTRACT_H */62 