Mercurial > cpython-lru_cache-weakref
annotate Objects/boolobject.c @ 24042:63fbbed10714 legacy-trunk
Simplify HTTPSConnection constructor.
See discussion in SF bug 458463.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Fri, 28 Jun 2002 23:38:14 +0000 |
| parents | ed1ba37a46b7 |
| children | 35dba6007ac3 |
| rev | line source |
|---|---|
|
22787
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 /* Boolean type, a subtype of int */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 #include "Python.h" |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 /* We need to define bool_print to override int_print */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 static int |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 bool_print(PyBoolObject *self, FILE *fp, int flags) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 { |
|
22789
97a34643e544
As Neal pointed out, bool_print was an order of magnitude too complex.
Guido van Rossum <guido@python.org>
parents:
22787
diff
changeset
|
10 fputs(self->ob_ival == 0 ? "False" : "True", fp); |
|
22787
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 return 0; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 /* We define bool_repr to return "False" or "True" */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 static PyObject *false_str = NULL; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 static PyObject *true_str = NULL; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 PyObject * |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 bool_repr(PyBoolObject *self) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 PyObject *s; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 if (self->ob_ival) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 s = true_str ? true_str : |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 (true_str = PyString_InternFromString("True")); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 else |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 s = false_str ? false_str : |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 (false_str = PyString_InternFromString("False")); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 Py_XINCREF(s); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 return s; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 /* Function to return a bool from a C long */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 PyObject *PyBool_FromLong(long ok) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 PyObject *result; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 if (ok) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 result = Py_True; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 else |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 result = Py_False; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 Py_INCREF(result); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 return result; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 /* We define bool_new to always return either Py_True or Py_False */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 PyObject * |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 static char *kwlist[] = {"x", 0}; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 PyObject *x; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 long ok; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:bool", kwlist, &x)) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 return NULL; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 ok = PyObject_IsTrue(x); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 if (ok < 0) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 return NULL; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 return PyBool_FromLong(ok); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 /* Arithmetic operations redefined to return bool if both args are bool. */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 static PyObject * |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 bool_and(PyObject *a, PyObject *b) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 if (!PyBool_Check(a) || !PyBool_Check(b)) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 return PyInt_Type.tp_as_number->nb_and(a, b); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 return PyBool_FromLong( |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 ((PyBoolObject *)a)->ob_ival & ((PyBoolObject *)b)->ob_ival); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 static PyObject * |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 bool_or(PyObject *a, PyObject *b) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 if (!PyBool_Check(a) || !PyBool_Check(b)) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 return PyInt_Type.tp_as_number->nb_or(a, b); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 return PyBool_FromLong( |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 ((PyBoolObject *)a)->ob_ival | ((PyBoolObject *)b)->ob_ival); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 static PyObject * |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 bool_xor(PyObject *a, PyObject *b) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 if (!PyBool_Check(a) || !PyBool_Check(b)) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
89 return PyInt_Type.tp_as_number->nb_xor(a, b); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 return PyBool_FromLong( |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 ((PyBoolObject *)a)->ob_ival ^ ((PyBoolObject *)b)->ob_ival); |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 } |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 /* Doc string */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 |
|
23832
ed1ba37a46b7
Patch #568124: Add doc string macros.
Martin v. Löwis <martin@v.loewis.de>
parents:
23276
diff
changeset
|
96 PyDoc_STRVAR(bool_doc, |
|
22787
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 "bool(x) -> bool\n\ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 \n\ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 Returns True when the argument x is true, False otherwise.\n\ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 The builtins True and False are the only two instances of the class bool.\n\ |
|
23832
ed1ba37a46b7
Patch #568124: Add doc string macros.
Martin v. Löwis <martin@v.loewis.de>
parents:
23276
diff
changeset
|
101 The class bool is a subclass of the class int, and cannot be subclassed."); |
|
22787
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 /* Arithmetic methods -- only so we can override &, |, ^. */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 static PyNumberMethods bool_as_number = { |
|
23276
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
106 0, /* nb_add */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
107 0, /* nb_subtract */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
108 0, /* nb_multiply */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
109 0, /* nb_divide */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
110 0, /* nb_remainder */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
111 0, /* nb_divmod */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
112 0, /* nb_power */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
113 0, /* nb_negative */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
114 0, /* nb_positive */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
115 0, /* nb_absolute */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
116 0, /* nb_nonzero */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
117 0, /* nb_invert */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
118 0, /* nb_lshift */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
119 0, /* nb_rshift */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
120 (binaryfunc)bool_and, /* nb_and */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
121 (binaryfunc)bool_xor, /* nb_xor */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
122 (binaryfunc)bool_or, /* nb_or */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
123 0, /* nb_coerce */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
124 0, /* nb_int */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
125 0, /* nb_long */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
126 0, /* nb_float */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
127 0, /* nb_oct */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
128 0, /* nb_hex */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
129 0, /* nb_inplace_add */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
130 0, /* nb_inplace_subtract */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
131 0, /* nb_inplace_multiply */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
132 0, /* nb_inplace_divide */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
133 0, /* nb_inplace_remainder */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
134 0, /* nb_inplace_power */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
135 0, /* nb_inplace_lshift */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
136 0, /* nb_inplace_rshift */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
137 0, /* nb_inplace_and */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
138 0, /* nb_inplace_xor */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
139 0, /* nb_inplace_or */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
140 0, /* nb_floor_divide */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
141 0, /* nb_true_divide */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
142 0, /* nb_inplace_floor_divide */ |
|
46450f17a070
Clean up the layout of the bool_as_number struct initializer.
Guido van Rossum <guido@python.org>
parents:
22789
diff
changeset
|
143 0, /* nb_inplace_true_divide */ |
|
22787
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 }; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 /* The type object for bool. Note that this cannot be subclassed! */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 PyTypeObject PyBool_Type = { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 PyObject_HEAD_INIT(&PyType_Type) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 0, |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 "bool", |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 sizeof(PyIntObject), |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 0, |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 0, /* tp_dealloc */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 (printfunc)bool_print, /* tp_print */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 0, /* tp_getattr */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
157 0, /* tp_setattr */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 0, /* tp_compare */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 (reprfunc)bool_repr, /* tp_repr */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 &bool_as_number, /* tp_as_number */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 0, /* tp_as_sequence */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 0, /* tp_as_mapping */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 0, /* tp_hash */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 0, /* tp_call */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 (reprfunc)bool_repr, /* tp_str */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
166 0, /* tp_getattro */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 0, /* tp_setattro */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 0, /* tp_as_buffer */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
169 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
170 bool_doc, /* tp_doc */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
171 0, /* tp_traverse */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 0, /* tp_clear */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 0, /* tp_richcompare */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
174 0, /* tp_weaklistoffset */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
175 0, /* tp_iter */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
176 0, /* tp_iternext */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
177 0, /* tp_methods */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
178 0, /* tp_members */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
179 0, /* tp_getset */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
180 &PyInt_Type, /* tp_base */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 0, /* tp_dict */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 0, /* tp_descr_get */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
183 0, /* tp_descr_set */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 0, /* tp_dictoffset */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 0, /* tp_init */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
186 0, /* tp_alloc */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
187 bool_new, /* tp_new */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
188 }; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
189 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
190 /* The objects representing bool values False and True */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
191 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
192 /* Named Zero for link-level compatibility */ |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
193 PyIntObject _Py_ZeroStruct = { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
194 PyObject_HEAD_INIT(&PyBool_Type) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
195 0 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
196 }; |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
197 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
198 PyIntObject _Py_TrueStruct = { |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
199 PyObject_HEAD_INIT(&PyBool_Type) |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
200 1 |
|
028ebc8fb390
Oops. Here are the new files. My apologies.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
201 }; |
