mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-11 08:50:31 +00:00
[BUGFIX] Fixing pybind11::error_already_set.matches to also work with exception subclasses (#1715)
* Fixing order of arguments in call to PyErr_GivenExceptionMatches in pybind11::error_already_set.matches * Added tests on error_already_set::matches fix for exception base classes
This commit is contained in:
committed by
Wenzel Jakob
parent
a0b8f70df4
commit
97784dad3e
@@ -344,7 +344,7 @@ public:
|
||||
/// Check if the currently trapped error type matches the given Python exception class (or a
|
||||
/// subclass thereof). May also be passed a tuple to search for any exception class matches in
|
||||
/// the given tuple.
|
||||
bool matches(handle ex) const { return PyErr_GivenExceptionMatches(ex.ptr(), m_type.ptr()); }
|
||||
bool matches(handle exc) const { return PyErr_GivenExceptionMatches(m_type.ptr(), exc.ptr()); }
|
||||
|
||||
const object& type() const { return m_type; }
|
||||
const object& value() const { return m_value; }
|
||||
|
||||
Reference in New Issue
Block a user