File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ PyBuffer_FromReadWriteMemory(void *ptr, int size)
141141PyObject *
142142PyBuffer_New (int size )
143143{
144+ PyObject * o ;
144145 PyBufferObject * b ;
145146
146147 if (size < 0 ) {
@@ -149,10 +150,10 @@ PyBuffer_New(int size)
149150 return NULL ;
150151 }
151152 /* PyObject_New is inlined */
152- b = ( PyBufferObject * ) PyObject_MALLOC (sizeof (* b ) + size );
153- if ( b == NULL )
153+ o = PyObject_MALLOC (sizeof (* b ) + size );
154+ if ( o == NULL )
154155 return PyErr_NoMemory ();
155- PyObject_INIT (( PyObject * )b , & PyBuffer_Type );
156+ b = ( PyBufferObject * ) PyObject_INIT ( o , & PyBuffer_Type );
156157
157158 b -> b_base = NULL ;
158159 b -> b_ptr = (void * )(b + 1 );
@@ -162,7 +163,7 @@ PyBuffer_New(int size)
162163 b -> b_hash = -1 ;
163164#endif
164165
165- return ( PyObject * ) b ;
166+ return o ;
166167}
167168
168169/* Methods */
Original file line number Diff line number Diff line change @@ -1123,6 +1123,10 @@ _PyTrash_deposit_object(PyObject *op)
11231123 typecode = Py_TRASHCAN_FRAME ;
11241124 else if (PyTraceBack_Check (op ))
11251125 typecode = Py_TRASHCAN_TRACEBACK ;
1126+ else /* We have a bug here -- those are the only types in GC */ {
1127+ Py_FatalError ("Type not supported in GC -- internal bug" );
1128+ return ; /* pacify compiler -- execution never here */
1129+ }
11261130 op -> ob_refcnt = typecode ;
11271131
11281132 op -> ob_type = (PyTypeObject * )_PyTrash_delete_later ;
You can’t perform that action at this time.
0 commit comments