Commit Graph

2936 Commits

Author SHA1 Message Date
Henry Schreiner
59f03ee389 tests: include pypy3.9 in nox if present
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-15 22:22:51 -05:00
Henry Schreiner
5116a629e9 fix(spelling): PYTHON_VERSIONS 2022-07-15 22:22:51 -05:00
Henry Schreiner
8d82f29887 chore: back to work
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-15 22:22:51 -05:00
Steve R. Sun
84ef55f4bc
Merge branch 'pybind:master' into master 2022-07-16 09:34:19 +08:00
Henry Schreiner
aa304c9c7d
chore: preapre for 2.10.0 release (#4068)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-15 15:47:47 -05:00
Henry Schreiner
87f64c4321
docs: update changelog for 2.10.0 (#4066) 2022-07-15 13:45:16 -05:00
Steve R. Sun
940d9dc335
Merge branch 'pybind:master' into master 2022-07-15 09:37:55 +08:00
Ralf W. Grosse-Kunstleve
1d81191077
Disable implicit conversion of 0 to pybind11::handle. (#4008)
* 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`.
2022-07-14 09:53:39 -07:00
Steve R. Sun
0056a3e156
Merge branch 'pybind:master' into master 2022-07-14 11:52:07 +08:00
Aaron Gokaslan
bc9315fe38
chore: optimize sparse matrix casting with python tuple (#4064)
* optimize casting of sparse Eigen arrays

* move array

* Revert for safety
2022-07-13 19:27:00 -04:00
Henry Schreiner
6b60d97d30
docs: use Furo (#3109)
* docs: try using Furo

* docs: darker output

* docs: improve logo for dark background

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-13 10:13:35 -05:00
Henry Schreiner
7c3a031766
chore: bump clang-tidy to 13 (#3997)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-13 09:06:32 -05:00
Steve R. Sun
17f60cb95a
Merge branch 'pybind:master' into master 2022-07-13 09:28:55 +08:00
Ralf W. Grosse-Kunstleve
023b3f32c8
Undo accidental one-line change under PR #3913 (#4060) 2022-07-12 12:02:20 -07:00
pre-commit-ci[bot]
790241bce2
[pre-commit.ci] pre-commit autoupdate (#4058)
updates:
- [github.com/asottile/pyupgrade: v2.34.0 → v2.37.1](https://github.com/asottile/pyupgrade/compare/v2.34.0...v2.37.1)
- [github.com/hadialqattan/pycln: v1.3.5 → v2.0.1](https://github.com/hadialqattan/pycln/compare/v1.3.5...v2.0.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-11 22:31:54 -04:00
Steve R. Sun
8f4556f22d
Merge branch 'pybind:master' into master 2022-07-11 14:43:59 +08:00
Aaron Gokaslan
f9f00495a3
Properly visit self in >=3.9 traverse (#4051)
* Properly visit self in >=3.9 traverse

* Add comment about 3.9 behavior
2022-07-09 21:43:53 -07:00
Steve R. Sun
2d3af75efb
Merge branch 'pybind:master' into master 2022-07-08 10:13:53 +08:00
Ralf W. Grosse-Kunstleve
432bc5cfb5
Add std::string clean_type_id(const char *typeid_name) overload (in namespace detail). (#4049)
Very minor refactoring to ease development and debugging.

Having to declare a local `std::string` has bugged me many times. Nice to get this little nuisance out of the way.

Extracted from PR #4022, where it is used like this:

```
    std::fprintf(stdout,
                 "\nTYPE_CASTER_ODR_GUARD_IMPL %s %s\n",
                 clean_type_id(intrinsic_type_info.name()).c_str(),
                 source_file_line_from_sloc.c_str());
```
2022-07-07 19:08:10 -07:00
Ralf W. Grosse-Kunstleve
85bc088441
Report C++ Info: via pytest_report_header() (#4046)
* Report `C++ Info:` from `pytest_configure()`

* Use pytest_report_header() as suggested by @skylion007
2022-07-07 17:51:44 -07:00
Steve R. Sun
5ef5a14cfa
Merge branch 'pybind:master' into master 2022-07-07 08:05:05 +08:00
Ralf W. Grosse-Kunstleve
cd08869df1
PYBIND11_NAMESPACE consistency fixes. (#4043) 2022-07-06 14:29:20 -07:00
Henry Schreiner
0ab1fcfb1c
docs: update changelog (#4042)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-06 16:36:05 -04:00
Aaron Gokaslan
2af163d9c7
Fix: 3.11 beta support (#3923)
* Placeholder commit for 3.11 testing

* Does this fix it?

* Try suggestion

* Placeholder commit for 3.11 testing

* Does this fix it?

* Try suggestion

* fix: try using modern init for embedded interp

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix: error message changed in 3.11

* fix: apply logic in Python manually

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* fix autodetect dynamic attrs in 3.11

* fix: include error message if possible in error

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* ci: enable standard Python 3.11 testing

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Make dynamic attrs condtiion exclusive to ver.

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-06 16:35:12 -04:00
Steve R. Sun
ae1880f848
Merge branch 'pybind:master' into master 2022-07-06 07:33:49 +08:00
pre-commit-ci[bot]
c42e3ab793
[pre-commit.ci] pre-commit autoupdate (#4041)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.3.0 → 22.6.0](https://github.com/psf/black/compare/22.3.0...22.6.0)
- [github.com/Lucas-C/pre-commit-hooks: v1.2.0 → v1.3.0](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.2.0...v1.3.0)
- [github.com/PyCQA/pylint: v2.14.3 → v2.14.4](https://github.com/PyCQA/pylint/compare/v2.14.3...v2.14.4)
- [github.com/pre-commit/mirrors-clang-format: v14.0.5 → v14.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.5...v14.0.6)

* Update blacken-docs

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>
2022-07-04 22:21:59 -04:00
Steve R. Sun
0acf526515
Merge branch 'pybind:master' into master 2022-07-05 09:26:02 +08:00
dependabot[bot]
bc1f9f9ba6
chore(deps): bump actions/setup-python from 3 to 4 (#3999)
* chore(deps): bump actions/setup-python from 3 to 4

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-07-04 10:24:55 -04:00
Henry Schreiner
5a3a1e3415
chore: simpler dependabot (#4035)
Ignores no longer needed after April 2022. Dependabot keeps the same style pinning now.
2022-07-04 10:24:34 -04:00
Steve R. Sun
5fad266bb1
Merge branch 'pybind:master' into master 2022-06-30 07:48:34 +08:00
Matthew Woehlke
479e9a50f3
Fix arrays with zero-size dimensions (#4038)
When converting an array to an Eigen matrix, ignore the strides if any
dimension size is 0. If the array is empty, the strides aren't relevant,
and especially numpy ≥ 1.23 explicitly sets the strides to 0 in this
case. (See numpy commit dd5ab7b11520.)

Update tests to verify that this works, and continues to work.
2022-06-29 11:37:16 -07:00
Steve R. Sun
196a544873
Merge branch 'pybind:master' into master 2022-06-29 09:14:05 +08:00
Masaki Kozuki
374a5b000a
[docs] Fix "Enumerations and internal types" example (#4034)
* Fix binding of `Pet::Attributes`

* omit `attributes` as it's not needed

Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
2022-06-28 12:38:37 -07:00
Steve R. Sun
3de9be9d73
Merge branch 'pybind:master' into master 2022-06-28 11:27:28 +08:00
pre-commit-ci[bot]
dd3bf7fd12
[pre-commit.ci] pre-commit autoupdate (#4030)
updates:
- [github.com/hadialqattan/pycln: v1.3.3 → v1.3.5](https://github.com/hadialqattan/pycln/compare/v1.3.3...v1.3.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-27 19:39:19 -04:00
Steve R. Sun
fafcb825c8
Merge branch 'pybind:master' into master 2022-06-22 07:40:38 +08:00
Henry Schreiner
c3e9173f0f
ci: use almalinux instead of centos, add 9 (#4020)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-06-21 14:55:49 -04:00
pre-commit-ci[bot]
2ad974c945
[pre-commit.ci] pre-commit autoupdate (#4021)
updates:
- [github.com/PyCQA/pylint: v2.14.1 → v2.14.3](https://github.com/PyCQA/pylint/compare/v2.14.1...v2.14.3)
- [github.com/pre-commit/mirrors-clang-format: v14.0.4-1 → v14.0.5](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.4-1...v14.0.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-21 14:36:49 -04:00
Steve R. Sun
46a1b76fad
Merge branch 'pybind:master' into master 2022-06-15 07:46:25 +08:00
Aaron Gokaslan
0964a9093a
Add a missing std::move in numpy.h (#4005) 2022-06-14 14:20:26 -04:00
pre-commit-ci[bot]
21f0e72b0f
[pre-commit.ci] pre-commit autoupdate (#4003) 2022-06-13 21:02:25 -04:00
Steve R. Sun
a40a44474c
Merge branch 'pybind:master' into master 2022-06-09 10:25:45 +08:00
dependabot[bot]
0e956a2e4f
chore(deps): bump pre-commit/action from 2.0.3 to 3.0.0 (#3992)
Bumps [pre-commit/action](https://github.com/pre-commit/action) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/pre-commit/action/releases)
- [Commits](https://github.com/pre-commit/action/compare/v2.0.3...v3.0.0)

---
updated-dependencies:
- dependency-name: pre-commit/action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 09:22:57 -04:00
Steve R. Sun
a2ec9142ed
Merge branch 'pybind:master' into master 2022-06-07 12:06:04 +08:00
Aaron Gokaslan
e2dcd95407
chore: optimize dictionary access in strip_padding numpy (#3994)
* emplace field descriptors

* reserve sufficient capacity

* remove std::move

* properly iterate through dict

* make handle casting more explicit

* Revert to old dict api
2022-06-06 22:33:28 -04:00
Steve R. Sun
bb6ae5013c
Merge branch 'pybind:master' into master 2022-06-07 09:41:13 +08:00
Maarten Baert
918892b97e
Make dtype::num() return type consistent with other functions (#3995) 2022-06-06 19:41:38 -04:00
pre-commit-ci[bot]
c5fa3436c6
[pre-commit.ci] pre-commit autoupdate (#3951)
updates:
- [github.com/asottile/pyupgrade: v2.32.1 → v2.33.0](https://github.com/asottile/pyupgrade/compare/v2.32.1...v2.33.0)
- [github.com/Lucas-C/pre-commit-hooks: v1.1.13 → v1.2.0](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.1.13...v1.2.0)
- [github.com/hadialqattan/pycln: v1.3.2 → v1.3.3](https://github.com/hadialqattan/pycln/compare/v1.3.2...v1.3.3)
- [github.com/PyCQA/pylint: v2.13.8 → v2.14.1](https://github.com/PyCQA/pylint/compare/v2.13.8...v2.14.1)
- [github.com/pre-commit/mirrors-mypy: v0.950 → v0.960](https://github.com/pre-commit/mirrors-mypy/compare/v0.950...v0.960)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-06 17:56:18 -04:00
Aaron Gokaslan
554c045377
enable two new clang-tidy checks (#3988)
* enable two new clang-tidy checks

* Use better loop var for char
2022-06-06 12:15:45 -04:00
Steve R. Sun
e9a70ce059
Merge branch 'pybind:master' into master 2022-06-04 19:40:15 +08:00