Guido van Rossum | 5f82036 | 2002-04-03 23:01:45 +0000 | [diff] [blame^] | 1 | /* Boolean object interface */ |
| 2 | |
| 3 | typedef PyIntObject PyBoolObject; |
| 4 | |
| 5 | extern DL_IMPORT(PyTypeObject) PyBool_Type; |
| 6 | |
| 7 | #define PyBool_Check(x) ((x)->ob_type == &PyBool_Type) |
| 8 | |
| 9 | /* Py_False and Py_True are the only two bools in existence. |
| 10 | Don't forget to apply Py_INCREF() when returning either!!! */ |
| 11 | |
| 12 | /* Don't use these directly */ |
| 13 | extern DL_IMPORT(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; |
| 14 | |
| 15 | /* Use these macros */ |
| 16 | #define Py_False ((PyObject *) &_Py_ZeroStruct) |
| 17 | #define Py_True ((PyObject *) &_Py_TrueStruct) |
| 18 | |
| 19 | /* Function to return a bool from a C long */ |
| 20 | PyObject *PyBool_FromLong(long); |