Unverified Commit 44596bc4 authored by Peter Hawkins's avatar Peter Hawkins Committed by GitHub
Browse files

Fix exception handling when pybind11::weakref() fails. (#3739)



* Clear Python error state if pybind11::weakref() fails.

The weakref() constructor calls pybind11_fail() without clearing any
Python interpreter error state. If a client catches the C++ exception
thrown by pybind11_fail(), the Python interpreter will be left in an
error state.

* Add test case for failing to create weakref

* Add Debug asserts for pybind11 fail

* Make error handling more pythonic

* Does this fix PyPy?

* Adapt test to PyPy differences

* Simplify test to remove redundancy

Co-authored-by: default avatarAaron Gokaslan <skylion.aaron@gmail.com>
parent 009ffc33
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment