Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 'upstream/master' (v2.10.0, aa304c9c) #63

Conversation

EricCousineau-TRI
Copy link
Collaborator

@EricCousineau-TRI EricCousineau-TRI commented Oct 12, 2023

Cleaner version of #61

Prior merge base with a bit before v2.9.0
Adds v2.9.0, v2.9.1, v2.9.2

EDIT: Er, v2.9.2 seems like it's not part of mainline.


This change is Reviewable

henryiii and others added 30 commits October 4, 2021 15:20
updates:
- [github.com/asottile/pyupgrade: v2.28.0 → v2.29.0](asottile/pyupgrade@v2.28.0...v2.29.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Bumps [ilammy/msvc-dev-cmd](https://github.com/ilammy/msvc-dev-cmd) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/ilammy/msvc-dev-cmd/releases)
- [Commits](ilammy/msvc-dev-cmd@v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: ilammy/msvc-dev-cmd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add additional pygrep pre-commit hooks

* Remove useless noqas with hook

* Fix all single rst backticks

* Simplify mypy pre-commit hook with upstream fixes

* Add back missing comment

* Add one last pygrep hook
typo correction

pybind11/exec.h → pybind11/eval.h
…nd#3348)

* Add a test showing a flaw in make_key_iterator/make_value_iterator

If the iterator dereference operator returns a value rather than a
reference (and that pair also does not *contain* references),
make_key_iterator and make_value_iterator will return a reference to a
temporary, causing a segfault.

* Fix make_key_iterator/make_value_iterator for prvalue iterators

If an iterator returns a pair<T1, T2> rather than a reference to a pair
or a pair of references, make_key_iterator and make_value_iterator would
return a reference to a temporary, typically leading to a segfault. This
is because the value category of member access to a prvalue is an
xvalue, not a prvalue, so decltype produces an rvalue reference type.
Fix the type calculation to handle this case.

I also removed some decltype parentheses that weren't needed, either
because the expression isn't one of the special cases for decltype or
because decltype was only used for SFINAE. Hopefully that makes the code
a bit more readable.

Closes pybind#3347

* Attempt a workaround for nvcc
updates:
- [github.com/PyCQA/flake8: 3.9.2 → 4.0.1](PyCQA/flake8@3.9.2...4.0.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ression around Eigen includes. (pybind#3352)

* 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 pybind#3343, with extra line breaks to not run past 99 columns (our desired but currently not enforced limit).
* fix: deprecate make_simple_namespace, fix Python 3.11

* docs: update links
* Add C++ bindings to throw AttributeError

* Fix formatting bug
* fix: MSVC 2017 C++17 on Python 3 regression

* ci: add 3.7 job on CI
updates:
- [github.com/asottile/yesqa: v1.2.3 → v1.3.0](asottile/yesqa@v1.2.3...v1.3.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…ybind#3376)

* 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 pybind#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 <[email protected]>
Co-authored-by: Henry Schreiner <[email protected]>
* 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
* docs: changelog update for 2.8.1

* chore: add one more entry

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
henryiii and others added 19 commits July 13, 2022 09:06
* docs: try using Furo

* docs: darker output

* docs: improve logo for dark background

Signed-off-by: Henry Schreiner <[email protected]>
* optimize casting of sparse Eigen arrays

* move array

* Revert for safety
* Disable implicit conversion from `0` to `pybind11::handle`.

* Reverse or-ed condition in an attempt to resolve GCC 8.3.0 errors (i386/debian:buster).

* Trying the simpler `std::is_same<T, PyObject *>`

* Add implicit_conversion_from_pytorch_THPObjectPtr_to_handle test.

* Accommodate types with implicit conversions to `PyObject *`, other than `handle` & `handle` subclasses, or integral types.

* Fix copy-paste mishap (picked wrong name).

* Revamp SFINAE construct to actually fix the pytorch issue (already validated against pytorch proper).

The first version of the reduced pytorch code was critically missing the move ctor. The first version of the accompanying test was meaningless.

Note: It turns out the `!std::is_arithmetic<T>` condition is not needed: `int` is not in general implicitly convertible to `PyObject *`, only the literal `0` is.

* Use `NOLINT(performance-noexcept-move-constructor)` for reduced code from the wild (rather than changing the code).

* Use any_of, all_of, negation. It turns out to clang-format nicer.

* Clean up comments for changed code.

* Reduce pytorch situation further, add test for operator ... const.

* Use `none_of` as suggested by @Skylion007

* Add `pure_compile_tests_for_handle_from_PyObject_pointers()`

* Fix inconsequential oversight (retested).

* Factor our `is_pyobj_ptr_or_nullptr_t` to make the SFINAE conditions more readable.

* Remove stray line (oversight).

* Make the `pure_compile_tests_for_handle_from_PyObject_pointers()` "rhs-const-complete", too.

* Remove the temporary PYBIND11_UNDO_PR4008 `#ifdef`.
We add `./tmp` to ensure we can make a commit to connect history with
upstream in a fast-forward way

# Conflicts:
#	.github/workflows/ci.yml
#	.github/workflows/format.yml
#	.github/workflows/pip.yml
#	README.rst
#	docs/advanced/cast/overview.rst
#	include/pybind11/cast.h
#	include/pybind11/detail/internals.h
#	include/pybind11/detail/type_caster_base.h
#	include/pybind11/eigen.h
#	include/pybind11/pybind11.h
#	tests/test_eigen.cpp
#	tests/test_multiple_inheritance.cpp
# Conflicts:
#	.github/workflows/ci.yml
# Conflicts:
#	.github/workflows/ci.yml
#	include/pybind11/detail/type_caster_base.h
#	include/pybind11/eigen.h
#	include/pybind11/pybind11.h
# Conflicts:
#	include/pybind11/cast.h
#	include/pybind11/detail/common.h
#	include/pybind11/detail/internals.h
#	include/pybind11/detail/type_caster_base.h
#	include/pybind11/eigen.h
#	include/pybind11/numpy.h
#	include/pybind11/pybind11.h
#	include/pybind11/pytypes.h
#	tests/test_builtin_casters.cpp
#	tests/test_eigen.cpp
#	tests/test_multiple_inheritance.cpp
@EricCousineau-TRI EricCousineau-TRI changed the title Feature bump merge curated Merge 'upstream/master' (v2.10.0, aa304c9c) Oct 12, 2023
@EricCousineau-TRI EricCousineau-TRI force-pushed the feature-bump-merge-curated branch from 6e70742 to cc9fb57 Compare October 12, 2023 22:45
@EricCousineau-TRI EricCousineau-TRI force-pushed the feature-bump-merge-curated branch from dee748a to 265b71b Compare October 17, 2023 17:31
@EricCousineau-TRI
Copy link
Collaborator Author

Closing in lieu of #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.