* Raise codec errors when casting to std::string
Allow the codec's exception to be raised instead of RuntimeError when
casting from py::str to std::string.
PY2 allows ucs surrogates in UTF-8 conversion
Signed-off-by: Shane Loretz <sloretz@openrobotics.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
* Attempt to fix py2 error
* Revert all unicode literals
* Fixed
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
* Manually moving `// NOLINT` comments so that clang-format does not move them to the wrong places.
* Manually reformatting comments related to `static_assert`s so that clang-format does not need two passes.
* Empty lines between #includes, to prevent clang-format from shuffling the order and thereby confusing MSVC 2015.
* git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
For single-file extensions, a convenient pattern offered by cython
is to place the source files directly in the python source tree
(`foo/__init__.py`, `foo/ext.pyx`), deriving the package names from
their filesystem location. Adapt this pattern for pybind11, using an
`intree_extensions` helper, which should be thought of as the moral
equivalent to `cythonize`.
Differences with cythonize: I chose not to include globbing support
(`intree_extensions(glob.glob("**/*.cpp"))` seems sufficient), nor to
provide extension-customization kwargs (directly setting the attributes
on the resulting Pybind11Extension objects seems sufficient).
We could choose to have `intree_extension` (singular instead) and make
users write `[*map(intree_extension, glob.glob("**/*.cpp"))]`; no strong
opinion here.
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
* Adding test_return_vector_bool_raw_ptr to test_stl.py.
* First attempt to make the documentation more accurate, but not trying to be comprehensive, to not bloat the reference table with too many details.
* Fixing minor oversights.
* Applying reviewer suggestion.
* Adding iostream.h thread-safety documentation.
* Restoring `TestThread` code with added `std::lock_guard<std::mutex>`.
* Updating new comments to reflect new information.
* Fixing up `git rebase -X theirs` accidents.
* * Rollback of PR #3068.
* Using latest pytest main branch for 3.9 and 3.10.
* WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 in test_class_sh_trampoline_shared_from_this.py
First experiment combining two potential fixes: latest pytest, workaround.
If this succeeds the next step will be to try only latest pytest without the workaround.
Note: the workaround is known to resolve the MSAN error reported under
https://github.com/pybind/pybind11/pull/3068#issuecomment-877658470
* WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 = False
* Narrowing down WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 to Python 3.9
* Splitting out pybind11/stl/filesystem.h.
To solve breakages like: https://github.com/deepmind/open_spiel/runs/2999582108
Mostly following the suggestion here: https://github.com/pybind/pybind11/pull/2730#issuecomment-750507575
Except using pybind11/stl/filesystem.h instead of pybind11/stlfs.h, as decided via chat.
stl.h restored to the exact state before merging PR #2730 via:
```
git checkout 733f8de24f stl.h
```
* Properly including new stl subdirectory in pip wheel config.
This now passes interactively:
```
pytest tests/extra_python_package/
```
* iwyu cleanup.
iwyuh.py -c -std=c++17 -DPYBIND11_TEST_BOOST -Ipybind11/include -I/usr/include/python3.9 -I/usr/include/eigen3 include/pybind11/stl/filesystem.h
* Adding PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL.
* Eliminating else after return.
* Unify cast_error message thrown by [simple|unpacking]_collector
simple_collector and unpacking_collector throw different error messages
when the casting of an argument failed: While the former mentions make_tuple(),
the latter emphasises the call argument (and its name/position).
* Consolidating "Unable to convert call argument" error reporting code to guarantee uniformity.
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>