Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Include/boolobject.h
Line
Count
Source
1
/* Boolean object interface */
2
3
#ifndef Py_BOOLOBJECT_H
4
#define Py_BOOLOBJECT_H
5
#ifdef __cplusplus
6
extern "C" {
7
#endif
8
9
10
PyAPI_DATA(PyTypeObject) PyBool_Type;
11
12
#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
13
14
/* Py_False and Py_True are the only two bools in existence.
15
Don't forget to apply Py_INCREF() when returning either!!! */
16
17
/* Don't use these directly */
18
PyAPI_DATA(PyLongObject) _Py_FalseStruct;
19
PyAPI_DATA(PyLongObject) _Py_TrueStruct;
20
21
/* Use these macros */
22
#define Py_False _PyObject_CAST(&_Py_FalseStruct)
23
#define Py_True _PyObject_CAST(&_Py_TrueStruct)
24
25
// Test if an object is the True singleton, the same as "x is True" in Python.
26
PyAPI_FUNC(int) Py_IsTrue(PyObject *x);
27
#define Py_IsTrue(x) Py_Is((x), Py_True)
28
29
// Test if an object is the False singleton, the same as "x is False" in Python.
30
PyAPI_FUNC(int) Py_IsFalse(PyObject *x);
31
#define Py_IsFalse(x) Py_Is((x), Py_False)
32
33
/* Macros for returning Py_True or Py_False, respectively */
34
#define Py_RETURN_TRUE 
return 31.3M
Py_NewRef(Py_True)
35
#define Py_RETURN_FALSE 
return 28.5M
Py_NewRef(Py_False)
36
37
/* Function to return a bool from a C long */
38
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
39
40
#ifdef __cplusplus
41
}
42
#endif
43
#endif /* !Py_BOOLOBJECT_H */