* Content of PR #4374 applied on top of smart_holder branch.
* More tests, with USE_SH switch. [ci skip]
* Use `std::dynamic_pointer_cast<Base0>` [ci skip]
* All tests pass when using `m.make_derived_as_base0_raw_ptr()`, with `USE_SH` defined or not defined. [ci skip]
* WIP
* Debug LOOOK & one-line bug fix:
```diff
- auto smhldr = pybindit::memory::smart_holder::from_shared_ptr(src);
+ auto smhldr = pybindit::memory::smart_holder::from_shared_ptr(std::shared_ptr<void>(src, const_cast<void *>(st.first)));
```
* Remove all print LOOOK and clang-format the fix.
* Resolve clang-tidy errors.
* Systematic test matrix.
* Bug fix in `smart_holder_type_caster<std::unique_ptr<T, D>>::cast()`
* Rename: test_mi_debug -> test_class_sh_mi_thunks
* Add `test_ptrdiff_derived_base0()`
* Miscellaneous polishing (naming, comments). No functional changes.
* Improve test_class_sh_mi_thunks.py implementation. No change in test coverage.
* Resolve clang-tidy error.
* First draft of Eigen::Tensor support
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix build errors
* Weird allocator stuff?
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove unused + additional allocator junk
* Disable warning
* Use constexpr
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* clang tidy fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Resolve comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove auto constexpr function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try again for older C++
* Oops forgot constexpr
* Move to new files as suggested
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix weird tests
* Fix nits
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Oops, forgot import
* Fix clang 3.6 bug
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* More comprehensive test suite
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Refactor allocators to make things more clear
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Switch to std::copy
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Switch to DSizes instead of array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Address feedback
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix python + dummy c++ change to trigger build
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Alignment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add include guard
* Forgot inline
* Fix compiler warning
* Remove bad test
* Better type signatures
* Add guards to make compiler requirements more explicit
* style: pre-commit fixes
* Force rerun of tests due to flake
* style: pre-commit fixes
* Keep pragmas & all related comments together, add PLEASE KEEP IN SYNC
* Move headers out of detail
* style: pre-commit fixes
* Fix cmake
* Improve casting
* style: pre-commit fixes
* Add a ton more tests + refactor
* Improve names
* style: pre-commit fixes
* Update include/pybind11/eigen/tensor.h
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
* Fix tests
* style: pre-commit fixes
* Update
* Add a test to verify that strange numpy arrays work
* Fix dumb compiler warning
* Better tests
* Better tests
* Fix tests
* style: pre-commit fixes
* More test fixes
* style: pre-commit fixes
* A ton more test coverage
* Fix tests
* style: pre-commit fixes
* style: pre-commit fixes
* Add back constexpr
* Another test
* style: pre-commit fixes
* Improve tests
* Whoops
* Less magic numbers
* Update tests/test_eigen_tensor.py
Co-authored-by: Sergiu Deitsch <sergiud@users.noreply.github.com>
* Update tests/test_eigen_tensor.py
Co-authored-by: Sergiu Deitsch <sergiud@users.noreply.github.com>
* style: pre-commit fixes
* Fix tests
* style: pre-commit fixes
* Fix memory leak
* style: pre-commit fixes
* Fix order
* style: pre-commit fixes
* Add test to make sure unsafe casts fail
* Minor bug fix to work on 32 bit machines
* Implement convert flag
* style: pre-commit fixes
* Switch to correct TensorMap const use
* style: pre-commit fixes
* Support older versions of eigen
* Weird c++ compilers
* Fix Eigen bug
* Fix another eigen bug
* Yet another eigen bug
* Potential flakes?
* style: pre-commit fixes
* Rerun tests with dummy exception to find out what is going on
* Another dummy test run
* Ablate more
* Found the broken test?
* One step closer
* one step further
* Double check
* one thing at a time
* Give up and disable the test
* Clang lies about being gcc
* Oops, fix matrix test
* style: pre-commit fixes
* Add tests to verify scalar conversions
* style: pre-commit fixes
* Fix nits
* Support no_array
* Fix tests
* style: pre-commit fixes
* Silence compiler warning
* Improve build system for ancient compilers
* Make clang happy
* Make gcc happy
* Implement Skylion's suggestions
* Fix warning
* Inline const pointer check
* Implement suggestions
* style: pre-commit fixes
* Improve tests
* Typo
* style: pre-commit fixes
* Support Google's build environment
* style: pre-commit fixes
* Update include/pybind11/eigen/tensor.h
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
* style: pre-commit fixes
* Test cleanup per Skylion
* Switch to remvove_cv_t
* Cleaner test
* style: pre-commit fixes
* Remove tensor from eigen.h, update tests
* style: pre-commit fixes
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: Sergiu Deitsch <sergiud@users.noreply.github.com>
* Insert type_caster_odr_guard<> (an empty struct to start with).
* Add odr_guard_registry() used in type_caster_odr_guard() default constructor.
* Add minimal_real_caster (from PR #3862) to test_async, test_buffers
* VERY MESSY SNAPSHOT of WIP, this was the starting point for cl/454658864, which has more changes on top.
* Restore original test_async, test_buffers from current smart_holder HEAD
* Copy from cl/454991845 snapshot Jun 14, 5:08 PM
* Cleanup of tests. Systematically insert `if (make_caster<T>::translation_unit_local) {`
* Small simplification of odr_guard_impl()
* WIP
* Add PYBIND11_SOURCE_FILE_LINE macro.
* Replace PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER with PYBIND11_TYPE_CASTER_SOURCE_FILE_LINE, baked into PYBIND11_TYPE_CASTER macro.
* Add more PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL; resolves "unused" warning when compiling test_custom_type_casters.cpp
* load_type fixes & follow-on cleanup
* Strip ./ from source_file_line
* Add new tests to CMakeLists.txt, disable PYBIND11_WERROR
* Replace C++17 syntax. Compiles with Debian clang 13 C++11 mode, but fails to link. Trying GitHub Actions anyway to see if there are any platforms that support https://en.cppreference.com/w/cpp/language/tu_local before C++20. Note that Debian clang 13 C++17 works locally.
* Show C++ version along with ODR VIOLATION DETECTED message.
* Add source_file_line_basename()
* Introduce PYBIND11_TYPE_CASTER_ODR_GUARD_ON (but not set automatically).
* Minor cleanup.
* Set PYBIND11_TYPE_CASTER_ODR_GUARD_ON automatically.
* Resolve clang-tidy error.
* Compatibility with old compilers.
* Fix off-by-one in source_file_line_basename()
* Report PYBIND11_INTERNALS_ID & C++ Version from pytest_configure()
* Restore use of PYBIND11_WERROR
* Move cpp_version_in_use() from cast.h to pybind11_tests.cpp
* define PYBIND11_DETAIL_ODR_GUARD_IMPL_THROW_DISABLED true in test_odr_guard_1,2.cpp
* IWYU cleanup of detail/type_caster_odr_guard.h
* Replace `throw err;` to resolve clang-tidy error.
* Add new header filename to CMakeLists.txt, test_files.py
* Experiment: Try any C++17 compiler.
* Fix ifdef for pragma GCC diagnostic.
* type_caster_odr_guard_impl() cleanup
* Move type_caster_odr_guard to type_caster_odr_guard.h
* Rename test_odr_guard* to test_type_caster_odr_guard*
* Remove comments that are (now) more distracting than helpful.
* Mark tu_local_no_data_always_false operator bool as explicit (clang-tidy). See also: https://stackoverflow.com/questions/39995573/when-can-i-use-explicit-operator-bool-without-a-cast
* New PYBIND11_TYPE_CASTER_ODR_GUARD_STRICT option (current on by default).
* Add test_type_caster_odr_registry_values(), test_type_caster_odr_violation_detected_counter()
* Report UNEXPECTED: test_type_caster_odr_guard_2.cpp prevailed (but do not fail).
* Apply clang-tidy suggestion.
* Attempt to handle valgrind behavior.
* Another attempt to handle valgrind behavior.
* Yet another attempt to handle valgrind behavior.
* Trying a new direction: show compiler info & std for UNEXPECTED: type_caster_odr_violation_detected_count() == 0
* compiler_info MSVC fix. num_violations == 0 condition.
* assert pybind11_tests.compiler_info is not None
* Introduce `make_caster_intrinsic<T>`, to be able to undo the 2 changes from `load_type` to `load_type<T>`. This is to avoid breaking 2 `pybind11::detail::load_type()` calls found in the wild (Google global testing).
One of the breakages in the wild was: 0f0f600767/python/tensorstore/subscript_method.h (L61)
* Add test for stl.h / stl_bind.h mix.
Manually verified that the ODR guard detects the ODR violation:
```
C++ Info: Debian Clang 13.0.1 C++17 __pybind11_internals_v4_clang_libstdcpp_cxxabi1002_sh_def__
=========================================================== test session starts ============================================================
platform linux -- Python 3.9.12, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
...
================================================================= FAILURES =================================================================
_____________________________________________ test_type_caster_odr_violation_detected_counter ______________________________________________
def test_type_caster_odr_violation_detected_counter():
...
else:
> assert num_violations == 1
E assert 2 == 1
E +2
E -1
num_violations = 2
test_type_caster_odr_guard_1.py:51: AssertionError
========================================================= short test summary info ==========================================================
FAILED test_type_caster_odr_guard_1.py::test_type_caster_odr_violation_detected_counter - assert 2 == 1
======================================================= 1 failed, 5 passed in 0.08s ========================================================
```
* Eliminate need for `PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL` macro.
Copying code first developed by @amauryfa. I tried this at an earlier stage, but by itself this was insufficient. In the meantime I added in the TU-local mechanisms: trying again.
Passes local testing:
```
DISABLED std::system_error: ODR VIOLATION DETECTED: pybind11::detail::type_caster<mrc_ns::type_mrc>: SourceLocation1="/usr/local/google/home/rwgk/forked/pybind11/tests/test_type_caster_odr_guard_1.cpp:18", SourceLocation2="/usr/local/google/home/rwgk/forked/pybind11/tests/test_type_caster_odr_guard_2.cpp:19"
C++ Info: Debian Clang 13.0.1 C++17 __pybind11_internals_v4_clang_libstdcpp_cxxabi1002_sh_def__
=========================================================== test session starts ============================================================
platform linux -- Python 3.9.12, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /usr/local/google/home/rwgk/forked/pybind11/tests, configfile: pytest.ini
collected 6 items
test_type_caster_odr_guard_1.py::test_type_mrc_to_python PASSED
test_type_caster_odr_guard_1.py::test_type_mrc_from_python PASSED
test_type_caster_odr_guard_1.py::test_type_caster_odr_registry_values PASSED
test_type_caster_odr_guard_1.py::test_type_caster_odr_violation_detected_counter PASSED
test_type_caster_odr_guard_2.py::test_type_mrc_to_python PASSED
test_type_caster_odr_guard_2.py::test_type_mrc_from_python PASSED
============================================================ 6 passed in 0.01s =============================================================
```
* tu_local_descr with src_loc experiment
* clang-tidy suggested fixes
* Use source_file_line_from_sloc in type_caster_odr_guard_registry
* Disable type_caster ODR guard for __INTEL_COMPILER (see comment). Also turn off printf.
* Add missing include (discovered via google-internal testing).
* Work `scr_loc` into `descr`
* Use `TypeCasterType::name.sloc` instead of `source_file_line.sloc`
Manual re-verification:
```
+++ b/tests/test_type_caster_odr_guard_2.cpp
- // m.def("pass_vector_type_mrc", mrc_ns::pass_vector_type_mrc);
+ m.def("pass_vector_type_mrc", mrc_ns::pass_vector_type_mrc);
```
```
> assert num_violations == 1
E assert 2 == 1
num_violations = 2
test_type_caster_odr_guard_1.py:51: AssertionError
```
* Fix small oversight (src_loc::here() -> src_loc{nullptr, 0}).
* Remove PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL macro completely.
* Remove PYBIND11_TYPE_CASTER_SOURCE_FILE_LINE macro completely. Some small extra cleanup.
* Minor tweaks looking at the PR with a fresh eye.
* src_loc comments
* Add new test_descr_src_loc & and fix descr.h `concat()` `src_loc` bug discovered while working on the test.
* Some more work on source code comments.
* Fully document the ODR violations in the ODR guard itself and introduce `PYBIND11_TYPE_CASTER_ODR_GUARD_ON_IF_AVAILABLE`
* Update comment (incl. mention of deadsnakes known to not work as intended).
* Use no-destructor idiom for type_caster_odr_guard_registry, as suggested by @laramiel
* Fix clang-tidy error: 'auto reg' can be declared as 'auto *reg' [readability-qualified-auto,-warnings-as-errors]
* WIP
* Revert "WIP" (tu_local_no_data_always_false_base experiment).
This reverts commit 31e8ac562f.
* Change `PYBIND11_TYPE_CASTER_ODR_GUARD_ON` to `PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD`, based on a suggestion by @rainwoodman
* Improved `#if` determining `PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD`, based on suggestion by @laramiel
* Make `descr::sloc` `const`, as suggested by @rainwoodman
* Rename macro to `PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_DEBUG`, as suggested by @laramiel
* Tweak comments some more (add "white hat hacker" analogy).
* Bring back `PYBIND11_CPP17` in determining `PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD`, to hopefully resolve most if not all of the many CI failures (89 failing, 32 successful: https://github.com/pybind/pybind11/runs/7430295771).
* Try another workaround for `__has_builtin`-related breakages (https://github.com/pybind/pybind11/runs/7430720321).
* Remove `defined(__has_builtin)` and subconditions.
* Update "known to not work" expectation in test and comment.
* `pytest.skip` `num_violations == 0` only `#ifdef __NO_INLINE__` (irrespective of the compiler)
* Systematically change all new `#ifdef` to `#if defined` (review suggestion).
* Bring back MSVC comment that got lost while experimenting.
* Add test_namespace_visibility
To probe environment/toolchain/platform-specific behavior under the exact same conditions as normal tests.
(An earlier version of this code was used to inform PR #4043.)
* Disable flake8 in ubench/holder_comparison_*.py, to suppress new & useless diagnostics.
* Disable namespace_visibility_1s.cpp (tosee if that resolves the MSVC and CUDA `test_cross_module_exception_translator` failures).
* Turn off flake8 completely for ubench (the Strip unnecessary `# noqa`s action un-helpfully removed the added noqa).
* Disable test_namespace_visibility completely. Just keep the two .cpp files, only setting the module docstring and doing nothing else.
* Rename test_namespace_visibility.py to test_exc_namespace_visibility.py, so that it is imported by pytest before test_exceptions.py
* Add `set_property(SOURCE namespace_visibility_1s.cpp PROPERTY LANGUAGE CUDA)`
* Add reference to PR #4054
* Complete the documentation (comments in test_exc_namespace_visibility.py).
* Rename namespace_visibility.h to namespace_visibility.inl, as suggested by @charlesbeattie
* Transferred net diff from PR #3581, as-is.
* Automatic `pre-commit run --all-files` fixes. NO manual changes.
* Removing trailing `//` (originally added to manipulate clang-format), as suggested by @charlesbeattie back in Jan/Feb under PR #3581.
* Renaming `xetter_cpp_function` to `property_cpp_function` as suggested by @rainwoodman
* Fully explain the terse variable naming scheme in test_class_sh_property (as suggested by @rainwoodman)
* Also use parametrize for readonly, readwrite (as suggested by @rainwoodman)
* Apply change suggested by @skylion007 (with clang-format).
* `#error BYE_BYE_GOLDEN_SNAKE`
* Removing everything related to 2.7 from ci.yml
* Commenting-out Centos7
* Removing `PYTHON: 27` from .appveyor.yml
* "PY2" removal, mainly from tests. C++ code is not touched.
* Systematic removal of `u` prefix from `u"..."` and `u'...'` literals. Collateral cleanup of a couple minor other things.
* Cleaning up around case-insensitive hits for `[^a-z]py.*2` in tests/.
* Removing obsolete Python 2 mention in compiling.rst
* Proper `#error` for Python 2.
* Using PY_VERSION_HEX to guard `#error "PYTHON 2 IS NO LONGER SUPPORTED.`
* chore: bump pre-commit
* style: run pre-commit for pyupgrade 3+
* tests: use sys.version_info, not PY
* chore: more Python 2 removal
* Uncommenting Centos7 block (PR #3691 showed that it is working again).
* Update pre-commit hooks
* Fix pre-commit hook
* refactor: remove Python 2 from CMake
* refactor: remove Python 2 from setup code
* refactor: simplify, better static typing
* feat: fail with nice messages
* refactor: drop Python 2 C++ code
* docs: cleanup for Python 3
* revert: intree
revert: intree
* docs: minor touchup to py2 statement
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
* A way to register additional test targets.
* Support specifying tests with extension.
* Ensure TEST_OVERRIDE is backwards compatible.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Ensure regex is non greedy.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Replacing ICC C++14 with C++17
* ICPC: -diag-disable:conversion
Try to suppress the `-Werror-all` promotion in `#include <variant>`
* Trying `-DPYBIND11_WERROR=OFF`
* Trying `-Wno-conversion` (todo: make specific to C++17 if it works)
* Inserting -Wno-conversion only for C++17
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* ci: support Python 3.11-dev
Also update 3.10 to final, better PyPy usage
* fix: use PyFrame_GetCode on Python 3.9+
* ci: some bitiness of pypy not supported on win
* chore: update CMake support to 3.22rc1 to quiet warning
* fix: use dev version of py to fix Py 3.11
* tests: print proper Eigen version
* ci: include pypy2, not sure why
* ci: avoid running on Python 3.11 for now
* ci: fix runs
* ci: simpler PyPy usage, drop unmaintained scipy + pypy index
* ci: only binary numpy, wait on pypy 3.8
* refactor: address review
* fix: the types for return_value_policy_override in optional_caster
`return_value_policy_override` was not being applied correctly in
`optional_caster` in two ways:
- The `is_lvalue_reference` condition referenced `T`, which was the
`optional<T>` type parameter from the class, when it should have used `T_`,
which was the parameter to the `cast` function. `T_` can potentially be a
reference type, but `T` will never be.
- The type parameter passed to `return_value_policy_override` should be
`T::value_type`, not `T`. This matches the way that the other STL container
type casters work.
The result of these issues was that a method/property definition which used a
`reference` or `reference_internal` return value policy would create a Python
value that's bound by reference to a temporary C++ object, resulting in
undefined behavior. For reasons that I was not able to figure out fully, it
seems like this causes problems when using old versions of `boost::optional`,
but not with recent versions of `boost::optional` or the `libstdc++`
implementation of `std::optional`. The issue (that the override to
`return_value_policy::move` is never being applied) is present for all
implementations, it just seems like that somehow doesn't result in problems for
the some implementation of `optional`. This change includes a regression type
with a custom optional-like type which was able to reproduce the issue.
Part of the issue with using the wrong types may have stemmed from the type
variables `T` and `T_` having very similar names. This also changes the type
variables in `optional_caster` to use slightly more descriptive names, which
also more closely follow the naming convention used by the other STL casters.
Fixes#3330
* Fix clang-tidy complaints
* Add missing NOLINT
* Apply a couple more fixes
* fix: support GCC 4.8
* tests: avoid warning about unknown compiler for compilers missing C++17
* Remove unneeded test module attribute
* Change test enum to have more unique int values
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Adding MSVC C4127 suppression around Eigen includes.
* For MSVC 2015 only: also adding the C4127 suppression to test_eigen.cpp
* Copying original change from PR #3343, with extra line breaks to not run past 99 columns (our desired but currently not enforced limit).
* Fix `pybind11::object::operator=` to be safe if `*this` is accessible from Python
* Add `custom_type_setup` attribute
This allows for custom modifications to the PyHeapTypeObject prior to
calling `PyType_Ready`. This may be used, for example, to define
`tp_traverse` and `tp_clear` functions.
* Fix thread safety for pybind11 loader_life_support
Fixes issue: https://github.com/pybind/pybind11/issues/2765
This converts the vector of PyObjects to either a single void* or
a per-thread void* depending on the WITH_THREAD define.
The new field is used by each thread to construct a stack
of loader_life_support frames that can extend the life of python
objects.
The pointer is updated when the loader_life_support object is allocated
(which happens before a call) as well as on release.
Each loader_life_support maintains a set of PyObject references
that need to be lifetime extended; this is done by storing them
in a c++ std::unordered_set and clearing the references when the
method completes.
* Also update the internals version as the internal struct is no longer compatible
* Add test demonstrating threading works correctly.
It may be appropriate to run this under msan/tsan/etc.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update test to use lifetime-extended references rather than
std::string_view, as that's a C++ 17 feature.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Make loader_life_support members private
* Update version to dev2
* Update test to use python threading rather than concurrent.futures
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Remove unnecessary env in test
* Remove unnecessary pytest in test
* Use native C++ thread_local in place of python per-thread data structures to retain compatability
* clang-format test_thread.cpp
* Add a note about debugging the py::cast() error
* thread_test.py now propagates exceptions on join() calls.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* remove unused sys / merge
* Update include order in test_thread.cpp
* Remove spurious whitespace
* Update comment / whitespace.
* Address review comments
* lint cleanup
* Fix test IntStruct constructor.
* Add explicit to constructor
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Now also passes the open_spiel iterated_prisoners_dilemma_test ASAN clean, in addition to all pybind11 and PyCLIF unit tests.
The problem was that calling `std::shared_ptr<void>::reset()` with a `void` pointer cannot possibly update the `shared_from_this` `weak_ptr`.
The solution is to store a `shd_ptr_reset` function pointer in `guarded_deleter` (similar in idea to the stored function pointer for calling `delete`).
This commit still includes all debugging code, i.e. is "dirty". The code will be cleaned up after the GitHub CI is fully successful.