[NumPy-Tickets] [NumPy] #1605: Bug in numpy version 1.5.x: RuntimeWarning: tp_compare didn't return -1 or -2 for exception

NumPy Trac numpy-tickets@scipy....
Sun Sep 5 09:08:43 CDT 2010


#1605: Bug in numpy version 1.5.x: RuntimeWarning: tp_compare didn't return -1 or
-2 for exception
--------------------+-------------------------------------------------------
 Reporter:  maldun  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  1.5.1   
Component:  Other   |     Version:  1.5.0   
 Keywords:  sage    |  
--------------------+-------------------------------------------------------

Comment(by pv):

 Thanks for the report, I can reproduce the issue. The warning message
 originates from src/multiarray/buffer.c:_buffer_clear_info
 {{{
 static void
 _buffer_clear_info(PyObject *arr)
 {
     PyObject *key, *item_list, *item;
     _buffer_info_t *info;
     int k;

     if (_buffer_info_cache == NULL) {
         return;
     }

     key = PyLong_FromVoidPtr((void*)arr);
     item_list = PyDict_GetItem(_buffer_info_cache, key);
     if (item_list != NULL) {
         for (k = 0; k < PyList_GET_SIZE(item_list); ++k) {
             item = PyList_GET_ITEM(item_list, k);
             info = (_buffer_info_t*)PyLong_AsVoidPtr(item);
             _buffer_info_free(info);
         }
         PyDict_DelItem(_buffer_info_cache, key);  # <<<<<<<<<<<<<<<
 emitted from here
     }

     Py_DECREF(key);
 }
 }}}
 Where
 {{{
 (gdb) pyo _buffer_info_cache
 object  : {139509240: [139441632]}
 type    : dict
 refcount: 1
 address : 0x84a368c
 $4 = 48
 (gdb) pyo key
 object  : 139509240
 type    : int
 refcount: 1
 address : 0x8337d74
 $5 = 47
 }}}
 The `PyDict_DelItem` seems to fail, for a reason that I do not really
 understand yet -- the input arguments should be fine. Indeed, the
 `PyDict_GetItem` above succeeded!

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1605#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list