2021-05-27 15:00:18 +00:00
|
|
|
#pragma once
|
|
|
|
#include "pybind11_tests.h"
|
2022-02-10 20:17:07 +00:00
|
|
|
|
2021-05-27 15:00:18 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
// shared exceptions for cross_module_tests
|
|
|
|
|
2021-07-30 17:48:41 +00:00
|
|
|
class PYBIND11_EXPORT_EXCEPTION shared_exception : public pybind11::builtin_exception {
|
2021-05-27 15:00:18 +00:00
|
|
|
public:
|
|
|
|
using builtin_exception::builtin_exception;
|
|
|
|
explicit shared_exception() : shared_exception("") {}
|
Add `py::set_error()`, use in updated `py::exception<>` documentation (#4772)
* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.
* static py::exception<> -> static py::handle
* Add `py::set_error()` but also try the suggestion of @malfet (https://github.com/pytorch/pytorch/pull/106401#pullrequestreview-1559961407).
* clang 17 compatibility fixes (#4767)
* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.
* Add gcc:13 C++20
* Add silkeh/clang:16-bullseye C++20
* chore(deps): update pre-commit hooks (#4770)
updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.276...v0.0.281)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools (#4774)
* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools
* Update docs/compiling.rst
---------
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Provide better type hints for a variety of generic types (#4259)
* Provide better type hints for a variety of generic types
* Makes better documentation
* tuple, dict, list, set, function
* Move to py::typing
* style: pre-commit fixes
* Update copyright line with correct year and actual author. The author information was copy-pasted from the git log output.
---------
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Use `py::set_error()` everywhere possible (only one special case, in common.h).
Overload `py::set_error(py::handle, py::handle)`.
Change back to `static py::handle exc = ... .release();`
Deprecate `py::exception<>::operator()`
* Add `PYBIND11_WARNING_DISABLE` for INTEL and MSVC (and sort alphabetically).
* `PYBIND11_WARNING_DISABLE_INTEL(10441)` does not work.
For ICC only, falling back to the recommended `py::set_error()` to keep the testing simple.
It is troublesome to add `--diag-disable=10441` specifically for test_exceptions.cpp, even that is non-ideal because it covers the entire file, not just the one line we need it for, and the value of exercising the trivial deprecated `operator()` on this one extra platform is practically zero.
* Fix silly oversight.
* NVHPC 23.5.0 generates deprecation warnings. They are currently not treated as errors, but falling back to using `py::set_error()` to not have to deal with that distraction.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Keto D. Zhang <keto.zhang@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
2023-08-08 03:48:20 +00:00
|
|
|
void set_error() const override { py::set_error(PyExc_RuntimeError, what()); }
|
2021-05-27 15:00:18 +00:00
|
|
|
};
|