• Peter Hawkins's avatar
    Fix exception handling when pybind11::weakref() fails. (#3739) · 44596bc4
    Peter Hawkins authored
    
    
    * 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>
    44596bc4
common.h 47.4 KB