Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: third_party/cython/src/Cython/Utility/CppSupport.cpp

Issue 385073004: Adding cython v0.20.2 in third-party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference cython dev list thread. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /////////////// CppExceptionConversion.proto ///////////////
2
3 #ifndef __Pyx_CppExn2PyErr
4 #include <new>
5 #include <typeinfo>
6 #include <stdexcept>
7 #include <ios>
8
9 static void __Pyx_CppExn2PyErr() {
10 // Catch a handful of different errors here and turn them into the
11 // equivalent Python errors.
12 try {
13 if (PyErr_Occurred())
14 ; // let the latest Python exn pass through and ignore the current one
15 else
16 throw;
17 } catch (const std::bad_alloc& exn) {
18 PyErr_SetString(PyExc_MemoryError, exn.what());
19 } catch (const std::bad_cast& exn) {
20 PyErr_SetString(PyExc_TypeError, exn.what());
21 } catch (const std::domain_error& exn) {
22 PyErr_SetString(PyExc_ValueError, exn.what());
23 } catch (const std::invalid_argument& exn) {
24 PyErr_SetString(PyExc_ValueError, exn.what());
25 } catch (const std::ios_base::failure& exn) {
26 // Unfortunately, in standard C++ we have no way of distinguishing EOF
27 // from other errors here; be careful with the exception mask
28 PyErr_SetString(PyExc_IOError, exn.what());
29 } catch (const std::out_of_range& exn) {
30 // Change out_of_range to IndexError
31 PyErr_SetString(PyExc_IndexError, exn.what());
32 } catch (const std::overflow_error& exn) {
33 PyErr_SetString(PyExc_OverflowError, exn.what());
34 } catch (const std::range_error& exn) {
35 PyErr_SetString(PyExc_ArithmeticError, exn.what());
36 } catch (const std::underflow_error& exn) {
37 PyErr_SetString(PyExc_ArithmeticError, exn.what());
38 } catch (const std::exception& exn) {
39 PyErr_SetString(PyExc_RuntimeError, exn.what());
40 }
41 catch (...)
42 {
43 PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
44 }
45 }
46 #endif
OLDNEW
« no previous file with comments | « third_party/cython/src/Cython/Utility/CppConvert.pyx ('k') | third_party/cython/src/Cython/Utility/CythonFunction.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698