Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-19 09:50:44

0001 #ifndef Py_INTERNAL_ABSTRACT_H
0002 #define Py_INTERNAL_ABSTRACT_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 #ifndef Py_BUILD_CORE
0008 #  error "this header requires Py_BUILD_CORE define"
0009 #endif
0010 
0011 // Fast inlined version of PyIndex_Check()
0012 static inline int
0013 _PyIndex_Check(PyObject *obj)
0014 {
0015     PyNumberMethods *tp_as_number = Py_TYPE(obj)->tp_as_number;
0016     return (tp_as_number != NULL && tp_as_number->nb_index != NULL);
0017 }
0018 
0019 PyObject *_PyNumber_PowerNoMod(PyObject *lhs, PyObject *rhs);
0020 PyObject *_PyNumber_InPlacePowerNoMod(PyObject *lhs, PyObject *rhs);
0021 
0022 extern int _PyObject_HasLen(PyObject *o);
0023 
0024 /* === Sequence protocol ================================================ */
0025 
0026 #define PY_ITERSEARCH_COUNT    1
0027 #define PY_ITERSEARCH_INDEX    2
0028 #define PY_ITERSEARCH_CONTAINS 3
0029 
0030 /* Iterate over seq.
0031 
0032    Result depends on the operation:
0033 
0034    PY_ITERSEARCH_COUNT:  return # of times obj appears in seq; -1 if
0035      error.
0036    PY_ITERSEARCH_INDEX:  return 0-based index of first occurrence of
0037      obj in seq; set ValueError and return -1 if none found;
0038      also return -1 on error.
0039    PY_ITERSEARCH_CONTAINS:  return 1 if obj in seq, else 0; -1 on
0040      error. */
0041 extern Py_ssize_t _PySequence_IterSearch(PyObject *seq,
0042                                          PyObject *obj, int operation);
0043 
0044 /* === Mapping protocol ================================================= */
0045 
0046 extern int _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
0047 
0048 extern int _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
0049 
0050 // Convert Python int to Py_ssize_t. Do nothing if the argument is None.
0051 // Export for '_bisect' shared extension.
0052 PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *);
0053 
0054 // Same as PyNumber_Index() but can return an instance of a subclass of int.
0055 // Export for 'math' shared extension.
0056 PyAPI_FUNC(PyObject*) _PyNumber_Index(PyObject *o);
0057 
0058 #ifdef __cplusplus
0059 }
0060 #endif
0061 #endif /* !Py_INTERNAL_ABSTRACT_H */