]> granicus.if.org Git - python/commitdiff
Replace a few places where X->ob_type was compared to &PyXXX_Type with
authorGuido van Rossum <guido@python.org>
Tue, 11 Sep 2001 16:13:52 +0000 (16:13 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 11 Sep 2001 16:13:52 +0000 (16:13 +0000)
calls to PyXXX_CheckExact(X).

Objects/floatobject.c
Objects/intobject.c

index beb35e9ca6197891c385dd5a19dd841db88c806f..d606547841c51cfd28488f3c260b30ce40e958cb 100644 (file)
@@ -775,7 +775,7 @@ PyFloat_Fini(void)
                for (i = 0, p = &list->objects[0];
                     i < N_FLOATOBJECTS;
                     i++, p++) {
-                       if (p->ob_type == &PyFloat_Type && p->ob_refcnt != 0)
+                       if (PyFloat_CheckExact(p) && p->ob_refcnt != 0)
                                frem++;
                }
                next = list->next;
@@ -785,7 +785,7 @@ PyFloat_Fini(void)
                        for (i = 0, p = &list->objects[0];
                             i < N_FLOATOBJECTS;
                             i++, p++) {
-                               if (p->ob_type != &PyFloat_Type ||
+                               if (!PyFloat_CheckExact(p) ||
                                    p->ob_refcnt == 0) {
                                        p->ob_type = (struct _typeobject *)
                                                free_list;
@@ -818,7 +818,7 @@ PyFloat_Fini(void)
                        for (i = 0, p = &list->objects[0];
                             i < N_FLOATOBJECTS;
                             i++, p++) {
-                               if (p->ob_type == &PyFloat_Type &&
+                               if (PyFloat_CheckExact(p) &&
                                    p->ob_refcnt != 0) {
                                        char buf[100];
                                        PyFloat_AsString(buf, p);
index 12edb510026511ec4a027201f9b1039bb67b008f..261edb84433f2b0d22ac03349a1da740845542ac 100644 (file)
@@ -134,7 +134,7 @@ PyInt_FromLong(long ival)
 static void
 int_dealloc(PyIntObject *v)
 {
-       if (v->ob_type == &PyInt_Type) {
+       if (PyInt_CheckExact(v)) {
                v->ob_type = (struct _typeobject *)free_list;
                free_list = v;
        }
@@ -999,7 +999,7 @@ PyInt_Fini(void)
                for (i = 0, p = &list->objects[0];
                     i < N_INTOBJECTS;
                     i++, p++) {
-                       if (p->ob_type == &PyInt_Type && p->ob_refcnt != 0)
+                       if (PyInt_CheckExact(p) && p->ob_refcnt != 0)
                                irem++;
                }
                next = list->next;
@@ -1009,7 +1009,7 @@ PyInt_Fini(void)
                        for (i = 0, p = &list->objects[0];
                             i < N_INTOBJECTS;
                             i++, p++) {
-                               if (p->ob_type != &PyInt_Type ||
+                               if (!PyInt_CheckExact(p) ||
                                    p->ob_refcnt == 0) {
                                        p->ob_type = (struct _typeobject *)
                                                free_list;
@@ -1052,7 +1052,7 @@ PyInt_Fini(void)
                        for (i = 0, p = &list->objects[0];
                             i < N_INTOBJECTS;
                             i++, p++) {
-                               if (p->ob_type == &PyInt_Type && p->ob_refcnt != 0)
+                               if (PyInt_CheckExact(p) && p->ob_refcnt != 0)
                                        fprintf(stderr,
                                "#   <int at %p, refcnt=%d, val=%ld>\n",
                                                p, p->ob_refcnt, p->ob_ival);