<div dir="ltr">I looked into at least adding a unit test to verify "except +" behavior for all operators and I found that aside from operator(), it seems that all operators ignore "except +".<div><br></div><div style>I have C++ code that can throw exceptions inside operator[] and sadly this ends up causing the python interpreter to abort.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 8, 2014 at 7:04 PM, J Robert Ray <span dir="ltr"><<a href="mailto:jrobertray@gmail.com" target="_blank">jrobertray@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I apologize for not having a working demonstration, but I have found this bug and verified it is still an issue in Cython 0.20.2. No try/catch block is generated for operator[]. In contrast, a try/catch block does get generated for operator().<div>
<br></div><div>If it is any use, here is a paraphrasing of the pyx code and the generated cpp code.</div><div><div><br></div><div>cdef extern from "blah.h" namespace "blah":</div>
<div>    cdef cppclass Blah:</div><div>        int operator[](int) except +</div><div><br></div><div>...</div><div><br></div><div>cdef class PyBlah:</div><div>    ...</div><div>    def demo(self, int index):</div><div>
        return deref(self.thisptr)[index]</div><div><br></div><div>...</div><div><br></div><div><div>/* "Blah.pyx":107</div><div> *     def demo(self, int index):<br></div><div> *         return deref(self.thisptr)[index]             # <<<<<<<<<<<<<<</div>
<div> */<br></div><div>  __Pyx_XDECREF(__pyx_r);</div><div>  __pyx_t_1 = __Pyx_PyInt_From_int(((*__pyx_v_self->thisptr)[__pyx_v_index])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</div>
<div>  __Pyx_GOTREF(__pyx_t_1);</div><div>  __pyx_r = __pyx_t_1;</div><div>  __pyx_t_1 = 0;</div><div>  goto __pyx_L0;</div><div><br></div><div><br></div><div>Please let me know if I'm doing anything wrong. Thanks!</div>
</div></div></div>
</blockquote></div><br></div>