FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/src/py_exceptions.h at master · smithsp/matplotlib · GitHub
smithsp
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
src
/
py_exceptions.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
72 lines (64 loc) · 4.75 KB
Breadcrumbs
matplotlib
/
src
/
py_exceptions.h
Copy path
File metadata and controls
72 lines (64 loc) · 4.75 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
-*- mode: c++; c-basic-offset: 4 -*-
*/
#
ifndef
__PY_EXCEPTIONS_H__
#
define
__PY_EXCEPTIONS_H__
#
include
<
exception
>
#
include
<
stdexcept
>
namespace
py
{
class
exception
:
public
std
::exception
{
public:
const
char
*
what
()
const
throw()
{
return
"
python error has been set
"
;
}
};
}
#
define
CALL_CPP_FULL
(
name, a, cleanup, errorcode
) \
try
\
{ \
a; \
} \
catch
(
const
py::exception &e) \
{ \
{ \
cleanup; \
} \
return
(errorcode); \
} \
catch
(
const
std::bad_alloc) \
{ \
PyErr_Format
(PyExc_MemoryError,
"
In %s: Out of memory
"
, (name)); \
{ \
cleanup; \
} \
return
(errorcode); \
} \
catch
(
const
std::overflow_error &e) \
{ \
PyErr_Format
(PyExc_OverflowError,
"
In %s: %s
"
, (name), e.
what
()); \
{ \
cleanup; \
} \
return
(errorcode); \
} \
catch
(
char
const
*e) \
{ \
PyErr_Format
(PyExc_RuntimeError,
"
In %s: %s
"
, (name), e); \
{ \
cleanup; \
} \
return
(errorcode); \
} \
catch
(...) \
{ \
PyErr_Format
(PyExc_RuntimeError,
"
Unknown exception in %s
"
, (name)); \
{ \
cleanup; \
} \
return
(errorcode); \
}
#
define
CALL_CPP_CLEANUP
(
name, a, cleanup
)
CALL_CPP_FULL
(name, a, cleanup,
NULL
)
#
define
CALL_CPP
(
name, a
)
CALL_CPP_FULL
(name, a, ,
NULL
)
#
define
CALL_CPP_INIT
(
name, a
)
CALL_CPP_FULL
(name, a, , -
1
)
#
endif
Back
|
FazBrowse Home
|
New Git URL