Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
8fbb5594
Commit
8fbb5594
authored
Mar 11, 2018
by
Antony Lee
Committed by
Jason Rhinelander
Apr 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify error_already_set documentation.
parent
289e5d9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
39 deletions
+39
-39
docs/advanced/exceptions.rst
+39
-39
No files found.
docs/advanced/exceptions.rst
View file @
8fbb5594
...
@@ -11,45 +11,45 @@ exceptions:
...
@@ -11,45 +11,45 @@ exceptions:
.. tabularcolumns:: |p{0.5\textwidth}|p{0.45\textwidth}|
.. tabularcolumns:: |p{0.5\textwidth}|p{0.45\textwidth}|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| C++ exception type | Python exception type |
| C++ exception type | Python exception type
|
+======================================+==============================+
+======================================+==============================
========
+
| :class:`std::exception` | ``RuntimeError`` |
| :class:`std::exception` | ``RuntimeError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`std::bad_alloc` | ``MemoryError`` |
| :class:`std::bad_alloc` | ``MemoryError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`std::domain_error` | ``ValueError`` |
| :class:`std::domain_error` | ``ValueError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`std::invalid_argument` | ``ValueError`` |
| :class:`std::invalid_argument` | ``ValueError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`std::length_error` | ``ValueError`` |
| :class:`std::length_error` | ``ValueError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`std::out_of_range` | ``ValueError`` |
| :class:`std::out_of_range` | ``ValueError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`std::range_error` | ``ValueError`` |
| :class:`std::range_error` | ``ValueError``
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`pybind11::stop_iteration` | ``StopIteration`` (used to
|
| :class:`pybind11::stop_iteration` | ``StopIteration`` (used to
implement
|
| |
implement custom iterators)
|
| |
custom iterators)
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
| :class:`pybind11::index_error` | ``IndexError`` (used to
|
| :class:`pybind11::index_error` | ``IndexError`` (used to
indicate out
|
| |
indicate out of bounds
|
| |
of bounds access in ``__getitem__``,
|
| |
accesses in ``__getitem__``,
|
| |
``__setitem__``, etc.)
|
| | ``__setitem__``, etc.) |
+--------------------------------------+--------------------------------------+
+--------------------------------------+------------------------------+
| :class:`pybind11::value_error` | ``ValueError`` (used to indicate |
|
:class:`pybind11::value_error` | ``ValueError`` (used to
|
|
| wrong value passed in
|
| |
indicate wrong value passed
|
| |
``container.remove(...)``)
|
| | in ``container.remove(...)`` |
+--------------------------------------+--------------------------------------+
+--------------------------------------+------------------------------+
| :class:`pybind11::key_error` | ``KeyError`` (used to indicate out |
|
:class:`pybind11::key_error` | ``KeyError`` (used to
|
|
| of bounds access in ``__getitem__``,
|
| |
indicate out of bounds
|
| |
``__setitem__`` in dict-like
|
| |
accesses in ``__getitem__``,
|
| |
objects, etc.)
|
| | ``__setitem__`` in dict-like |
+--------------------------------------+--------------------------------------+
|
| objects, etc.)
|
|
:class:`pybind11::error_already_set` | Indicates that the Python exception
|
+--------------------------------------+------------------------------+
| | flag has already been set via Python |
|
:class:`pybind11::error_already_set` | Indicates that the Python
|
|
| API calls from C++ code; this C++
|
| | exception
flag has already
|
| | exception
is used to propagate such
|
| |
been initialized
|
| |
a Python exception back to Python.
|
+--------------------------------------+------------------------------+
+--------------------------------------+------------------------------
--------
+
When a Python function invoked from C++ throws an exception, it is converted
When a Python function invoked from C++ throws an exception, it is converted
into a C++ exception of type :class:`error_already_set` whose string payload
into a C++ exception of type :class:`error_already_set` whose string payload
...
...
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