Robert Bradshaw, 19.07.2012 21:29: > On Thu, Jul 19, 2012 at 12:19 PM, Stefan Behnel wrote: >> Stefan Behnel, 15.07.2012 19:41: >>> Stefan Behnel, 29.06.2012 07:45: >>>> Robert Bradshaw, 28.06.2012 21:46: >>>>> I think it certainly makes sense to declare the default constructor as >>>>> "except +" (and std::bad_alloc should become MemoryError), >>>> >>>> Right. The code in the constructor can raise other exceptions that must >>>> also be handled properly. An explicit "except +" will handle that. >>> >>> What about the declarations that we ship in libcpp.*? They currently lack >>> any such exception declarations. Can we safely add them where appropriate? > > My thoughts are that we can (and should) safely > > (1) Add these exception declarations to our shipped pxd files, and
Ok. > (2) Let implicit constructors be declared as "except +MemoryError." We don't know if they are really just "implicit constructors" in the C++ code or if the user just left them out of the Cython declarations. So they may really exist in the C++ code and may raise other exceptions than just bad_alloc. Would you consider that a user error and ignore it? I wouldn't mind, bad declarations give bad code. A MemoryError may be rather misleading in cases, but it's more forgiving than a crash. Is there an actual advantage in only declaring one exception here? I recently implemented it as "except +". > If no one beats me too it, I suppose I could, but it's an easy bug for > anyone to knock off. Absolutely, a nice way of giving back to the project for anyone who can read the STL documentation of C++. Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel