pybind11/tests
Peter Hawkins 44596bc4ee
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: Aaron Gokaslan <skylion.aaron@gmail.com>
2022-02-18 14:12:00 -05:00
..
extra_python_package tests: use 'build' in tests instead of running setup.py (#3734) 2022-02-15 00:32:58 -05:00
extra_setuptools chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_cmake_build chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_embed Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
CMakeLists.txt Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
conftest.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
constructor_stats.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
cross_module_gil_utils.cpp Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
env.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
local_bindings.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
object.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_cross_module_tests.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_tests.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_tests.h Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
pytest.ini chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
requirements.txt tests: use 'build' in tests instead of running setup.py (#3734) 2022-02-15 00:32:58 -05:00
test_async.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_async.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_buffers.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_buffers.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_builtin_casters.cpp Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_builtin_casters.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_call_policies.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_call_policies.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_callbacks.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_callbacks.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_chrono.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_chrono.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_class.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_class.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_const_name.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_const_name.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_constants_and_functions.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_constants_and_functions.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_copy_move.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_copy_move.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_custom_type_casters.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_custom_type_casters.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_custom_type_setup.cpp Add custom_type_setup attribute (#3287) 2021-09-24 12:08:22 -07:00
test_custom_type_setup.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_docstring_options.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_docstring_options.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eigen.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_eigen.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_enum.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_enum.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eval_call.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eval.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_eval.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_exceptions.cpp Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_exceptions.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_exceptions.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_factory_constructors.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_factory_constructors.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_gil_scoped.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_gil_scoped.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_iostream.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_iostream.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_kwargs_and_defaults.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_kwargs_and_defaults.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_local_bindings.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_local_bindings.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_methods_and_attributes.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_methods_and_attributes.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_modules.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_modules.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_multiple_inheritance.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_multiple_inheritance.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_numpy_array.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_numpy_array.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_numpy_dtypes.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_numpy_dtypes.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_numpy_vectorize.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_numpy_vectorize.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_opaque_types.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_opaque_types.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_operator_overloading.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_operator_overloading.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_pickling.cpp Removing // clang-format off - on directives from test_pickling.cpp (#3738) 2022-02-15 11:51:17 -08:00
test_pickling.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_pytypes.cpp Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_pytypes.py Fix exception handling when pybind11::weakref() fails. (#3739) 2022-02-18 14:12:00 -05:00
test_sequences_and_iterators.cpp docs: Correct minor typos (#3721) 2022-02-11 10:42:48 -05:00
test_sequences_and_iterators.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_smart_ptr.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_smart_ptr.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_stl_binders.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_stl_binders.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_stl.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_stl.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_tagbased_polymorphic.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_tagbased_polymorphic.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_thread.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_thread.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_union.cpp Fix assertion failure for unions (#1685) (#1709) 2019-06-11 23:28:58 +02:00
test_union.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_virtual_functions.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_virtual_functions.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
valgrind-numpy-scipy.supp docs: fix various typos (#3075) 2021-07-04 19:58:35 -04:00
valgrind-python.supp chore: get PyPy 3.7 wheels using NumPy 1.20 (#2837) 2021-01-31 17:29:09 -05:00