On Feb 22, 2010, at 10:38 PM, Robert Bradshaw wrote: > On Feb 22, 2010, at 8:04 PM, Nick Joyce wrote: > >> On 22 Feb 2010, at 17:49, Robert Bradshaw wrote: >> >> I have amended the patch to include all of your comments, as well as >> included a simple test pyx. > > Thanks, I'll incorporate this into the main branch. Just as a style > issue, we usually abstract away the extra logic into a inline utility > function. > >> Let me know if I've missed anything. > > There is the case where hash() or cmp() raised an exception, so NULL > is returned but an index error should not be set (rather the original > exception should be propagated).
Unfortunately, PyDict_GetItem suppresses all such exceptions for historic reasons, but of course the getitem slot does not (which we must emulate). This results in the code being a bit uglier and reaching into Python's internals: http://hg.cython.org/cython-devel/rev/0df578d7a490 . This should probably be benchmarked to see if it's worth the bother. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
