]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Removing warnings found by gcc -Wall
authorMoshe Zadka <moshez@math.huji.ac.il>
Fri, 4 Aug 2000 15:36:13 +0000 (15:36 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Fri, 4 Aug 2000 15:36:13 +0000 (15:36 +0000)
Objects/bufferobject.c
Objects/object.c

index 67d26a17db596e0da5672910b784d5ae14f21a7c..91f58c906b0852e83cef87a05a8221385cf91fc9 100644 (file)
@@ -141,6 +141,7 @@ PyBuffer_FromReadWriteMemory(void *ptr, int size)
 PyObject *
 PyBuffer_New(int size)
 {
+       PyObject *o;
        PyBufferObject * b;
 
        if (size < 0) {
@@ -149,10 +150,10 @@ PyBuffer_New(int size)
                return NULL;
        }
        /* PyObject_New is inlined */
-       b = (PyBufferObject *) PyObject_MALLOC(sizeof(*b) + size);
-       if ( b == NULL )
+       o = PyObject_MALLOC(sizeof(*b) + size);
+       if ( o == NULL )
                return PyErr_NoMemory();
-       PyObject_INIT((PyObject *)b, &PyBuffer_Type);
+       b = (PyBufferObject *) PyObject_INIT(o, &PyBuffer_Type);
 
        b->b_base = NULL;
        b->b_ptr = (void *)(b + 1);
@@ -162,7 +163,7 @@ PyBuffer_New(int size)
        b->b_hash = -1;
 #endif
 
-       return (PyObject *) b;
+       return o;
 }
 
 /* Methods */
index 72c3013afb36d5c35bd98eb900ae178596e4e79e..a7df5260724c620530165b215e5eb20ab4effc6e 100644 (file)
@@ -1123,6 +1123,10 @@ _PyTrash_deposit_object(PyObject *op)
                typecode = Py_TRASHCAN_FRAME;
        else if (PyTraceBack_Check(op))
                typecode = Py_TRASHCAN_TRACEBACK;
+       else /* We have a bug here -- those are the only types in GC */ {
+               Py_FatalError("Type not supported in GC -- internal bug");
+               return; /* pacify compiler -- execution never here */
+       }
        op->ob_refcnt = typecode;
 
        op->ob_type = (PyTypeObject*)_PyTrash_delete_later;