Hello,

In trying to understand what is going on at the c level with some
cython code, I found that the html code generated with cython -a
doesn't always match the code in the c file.  I attached a rather
confusing case I found.  It's line 125 in the html file and line 1720
in the c code.

In essence, I'm trying to do buffer access; the cython code is

p1.y = y_edges[yi]

where y_edges is a buffer and p1 is an extension type with y defined
as an attribute.  The (sensible) c code generated in gridworld.c is:

    __pyx_t_9 = __pyx_v_yi;
    __pyx_v_p1->y = (*__Pyx_BufPtrCContig1d(float *,
__pyx_bstruct_y_edges.buf, __pyx_t_9, __pyx_bstride_0_y_edges

However, the html file shows this plus a ton of junk:

 125:             p1.y = y_edges[yi]
        __pyx_t_9 = __pyx_v_yi;
    __pyx_v_p1->y = (*__Pyx_BufPtrCContig1d(float *,
__pyx_bstruct_y_edges.buf, __pyx_t_9, __pyx_bstride_0_y_edges));

                        __pyx_2 = PyObject_GetAttr(__pyx_v_iterator,
__pyx_kp_next); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1];
__pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
            __pyx_3 = PyObject_Call(__pyx_2, ((PyObject
*)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename =
__pyx_f[1]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto
__pyx_L13_error;}
            Py_DECREF(__pyx_2); __pyx_2 = 0;
            __pyx_2 = __Pyx_GetItemInt(__pyx_3, 1, 0); if (!__pyx_2)
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno =
__LINE__; goto __pyx_L13_error;}
            Py_DECREF(__pyx_3); __pyx_3 = 0;
            __pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3)
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno =
__LINE__; goto __pyx_L13_error;}
            Py_DECREF(__pyx_2); __pyx_2 = 0;
            if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_dtype)))
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 125; __pyx_clineno =
__LINE__; goto __pyx_L13_error;}
            Py_DECREF(((PyObject *)__pyx_v_descr));
            __pyx_v_descr = ((PyArray_Descr *)__pyx_3);
            __pyx_3 = 0;
          }
          goto __pyx_L17_try;
          __pyx_L13_error:;
          Py_XDECREF(__pyx_2); __pyx_2 = 0;
          Py_XDECREF(__pyx_3); __pyx_3 = 0;

126: ....


If you'd like me to file a bug report, I'd be happy to.  I'm using the
latest version of cython from the repo, 1321:6e8c09631af4.

Thanks!
--Hoyt

++++++++++++++++++++++++++++++++++++++++++++++++
+ Hoyt Koepke
+ University of Washington Department of Statistics
+ http://www.stat.washington.edu/~hoytak/
+ [EMAIL PROTECTED]
++++++++++++++++++++++++++++++++++++++++++

Attachment: gwgenerated.tar.bz2
Description: BZip2 compressed data

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to