Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
78ee782b
Unverified
Commit
78ee782b
authored
Oct 23, 2021
by
Aaron Gokaslan
Committed by
GitHub
Oct 23, 2021
Browse files
feat: Add C++ binding to throw AttributeError (#3387)
* Add C++ bindings to throw AttributeError * Fix formatting bug
parent
076c89fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
docs/advanced/exceptions.rst
docs/advanced/exceptions.rst
+3
-1
include/pybind11/detail/common.h
include/pybind11/detail/common.h
+1
-0
No files found.
docs/advanced/exceptions.rst
View file @
78ee782b
...
@@ -56,7 +56,9 @@ at its exception handler.
...
@@ -56,7 +56,9 @@ at its exception handler.
+--------------------------------------+--------------------------------------+
+--------------------------------------+--------------------------------------+
| :class:`pybind11::buffer_error` | ``BufferError`` |
| :class:`pybind11::buffer_error` | ``BufferError`` |
+--------------------------------------+--------------------------------------+
+--------------------------------------+--------------------------------------+
| :class:`pybind11::import_error` | ``import_error`` |
| :class:`pybind11::import_error` | ``ImportError`` |
+--------------------------------------+--------------------------------------+
| :class:`pybind11::attribute_error` | ``AttributeError`` |
+--------------------------------------+--------------------------------------+
+--------------------------------------+--------------------------------------+
| Any other exception | ``RuntimeError`` |
| Any other exception | ``RuntimeError`` |
+--------------------------------------+--------------------------------------+
+--------------------------------------+--------------------------------------+
...
...
include/pybind11/detail/common.h
View file @
78ee782b
...
@@ -831,6 +831,7 @@ PYBIND11_RUNTIME_EXCEPTION(value_error, PyExc_ValueError)
...
@@ -831,6 +831,7 @@ PYBIND11_RUNTIME_EXCEPTION(value_error, PyExc_ValueError)
PYBIND11_RUNTIME_EXCEPTION
(
type_error
,
PyExc_TypeError
)
PYBIND11_RUNTIME_EXCEPTION
(
type_error
,
PyExc_TypeError
)
PYBIND11_RUNTIME_EXCEPTION
(
buffer_error
,
PyExc_BufferError
)
PYBIND11_RUNTIME_EXCEPTION
(
buffer_error
,
PyExc_BufferError
)
PYBIND11_RUNTIME_EXCEPTION
(
import_error
,
PyExc_ImportError
)
PYBIND11_RUNTIME_EXCEPTION
(
import_error
,
PyExc_ImportError
)
PYBIND11_RUNTIME_EXCEPTION
(
attribute_error
,
PyExc_AttributeError
)
PYBIND11_RUNTIME_EXCEPTION
(
cast_error
,
PyExc_RuntimeError
)
/// Thrown when pybind11::cast or handle::call fail due to a type casting error
PYBIND11_RUNTIME_EXCEPTION
(
cast_error
,
PyExc_RuntimeError
)
/// Thrown when pybind11::cast or handle::call fail due to a type casting error
PYBIND11_RUNTIME_EXCEPTION
(
reference_cast_error
,
PyExc_RuntimeError
)
/// Used internally
PYBIND11_RUNTIME_EXCEPTION
(
reference_cast_error
,
PyExc_RuntimeError
)
/// Used internally
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment