Commit Graph

3445 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
4f3a1a8231
Add test_class_sh_property_non_owning to CMakeLists.txt (#4590)
* use C++17 syntax to get rid of recursive template instantiations for concatenating type signatures (#4587)

* Apply descr.h `src_loc` change (smart_holder PR #4022) to code added with master PR #4587

* Add test_class_sh_property_non_owning to CMakeLists.txt (fixes oversight in PR #4586)

* Resolve clang-tidy errors.

* clang-tidy auto fix

---------

Co-authored-by: Konstantin Bespalov <kos5tya@yandex.ru>
2023-03-24 00:07:39 -07:00
Ralf W. Grosse-Kunstleve
13936bb258 Apply descr.h src_loc change (smart_holder PR #4022) to code added with master PR #4587 2023-03-23 22:12:13 -07:00
Ralf W. Grosse-Kunstleve
6b8264fb24 Merge branch 'master' into sh_merge_master 2023-03-23 22:05:18 -07:00
Konstantin Bespalov
5bbcba548a
use C++17 syntax to get rid of recursive template instantiations for concatenating type signatures (#4587) 2023-03-23 22:01:09 -07:00
Ralf W. Grosse-Kunstleve
083a03d122 Merge branch 'master' into sh_merge_master 2023-03-23 17:25:43 -07:00
Ralf W. Grosse-Kunstleve
37d0bf4289
[smart_holder] Enable properties for non-owning holders (#4586)
* Add test_class_sh_property_non_owning.cpp,py

Failing:

```
__________________________________________________________ test_persistent_holder __________________________________________________________

    def test_persistent_holder():
        h = m.DataFieldsHolder(2)
>       c = h.vec_at(0).core_fld
E       RuntimeError: Non-owning holder (loaded_as_shared_ptr).

h          = <pybind11_tests.class_sh_property_non_owning.DataFieldsHolder object at 0x7fabab516470>

test_class_sh_property_non_owning.py:6: RuntimeError
__________________________________________________________ test_temporary_holder ___________________________________________________________

    def test_temporary_holder():
        d = m.DataFieldsHolder(2).vec_at(1)
>       c = d.core_fld
E       RuntimeError: Non-owning holder (loaded_as_shared_ptr).

d          = <pybind11_tests.class_sh_property_non_owning.DataField object at 0x7fabab548770>

test_class_sh_property_non_owning.py:13: RuntimeError
```

* Introduce `shared_ptr_from_python(responsible_parent)` and use in all `property_cpp_function`s with `const shared_ptr<T> &` arguments.

Tests are incomplete.

* Complete tests.

* Add comment for `smart_holder_type_caster_load<T>::shared_ptr_from_python`
2023-03-23 17:21:41 -07:00
dependabot[bot]
286873ecf7
chore(deps): bump pypa/gh-action-pypi-publish from 1.8.1 to 1.8.3 (#4584)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.1 to 1.8.3.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.1...v1.8.3)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 10:23:52 -04:00
Ralf W. Grosse-Kunstleve
945be5bbd9 Merge branch 'master' into sh_merge_master 2023-03-16 21:36:21 -07:00
Ralf W. Grosse-Kunstleve
cf7d2e6f15
Change always_forkserver_on_unix() to use_multiprocessing_forkserver_on_linux() (#4577) 2023-03-16 14:33:34 -07:00
Henry Schreiner
c4c15d4b10
docs: changelog for 2.10.4 (#4532)
* docs: changelog for 2.10.4

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

* Apply suggestions from code review

* Update docs/changelog.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-03-16 16:01:28 -04:00
dependabot[bot]
04ef4e4229
chore(deps): bump pypa/gh-action-pypi-publish from 1.6.4 to 1.8.1 (#4576) 2023-03-16 18:18:44 +00:00
Ralf W. Grosse-Kunstleve
442261da58
Remove test code that does not exercise anything in pybind11, but breaks between Python 3.12alpha3 (still working) and 3.12alpha6 (broken): (#4559)
```
str(OrderedDict([(1, "a"), (2, "b")]))
```

Old:
```
OrderedDict([(1, 'a'), (2, 'b')])
```

New:
```
OrderedDict({1: 'a', 2: 'b'})
```

See also: https://github.com/python/cpython/issues/101446
2023-03-09 13:02:34 -08:00
pre-commit-ci[bot]
cbb876cc7b
chore(deps): update pre-commit hooks (#4552)
updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.251 → v0.0.254](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.251...v0.0.254)
- [github.com/PyCQA/pylint: v2.16.1 → v2.16.4](https://github.com/PyCQA/pylint/compare/v2.16.1...v2.16.4)
- [github.com/pre-commit/mirrors-mypy: v0.991 → v1.0.1](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.0.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-03-07 00:34:41 -05:00
Xiaofei Wang
114c0f2a3e
[smart_holder] Implement try_as_void_ptr_capsule as a free function (#4539)
* Move try_as_void_ptr_capsule out from modified_type_caster_generic_load_impl.

* Try fixing clangtidy
2023-02-28 17:35:21 -08:00
Eli Schwartz
3cc7e4258c
add --version option to pybind11-config (#4526)
Without this, it's impossible to get feature parity between detection
mechanisms. Both the pkg-config file and the cmake config set their
versions, but the python probe script didn't provide an option for this.

So you could print the compiler flags for using it, but you could not
check what you got.
2023-02-22 21:59:14 -08:00
Ralf W. Grosse-Kunstleve
480eb36b3a ubench ruff noqa (in files) 2023-02-22 14:05:23 -08:00
Ralf W. Grosse-Kunstleve
1c10b097a7 test_class_sh_void_ptr_capsule.py manual fixes for ruff 2023-02-22 13:01:46 -08:00
Ralf W. Grosse-Kunstleve
9b78303d7b trivial manual fixes for ruff 2023-02-22 13:00:31 -08:00
Ralf W. Grosse-Kunstleve
cee7cec5f4 ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
Ralf W. Grosse-Kunstleve
e0029bd3b0 ruff: exclude: ubench for now 2023-02-22 12:42:23 -08:00
Ralf W. Grosse-Kunstleve
9005b55bdf Merge branch 'master' into sh_merge_master 2023-02-22 12:32:31 -08:00
Ralf W. Grosse-Kunstleve
9a90783b1e Merge branch 'master' into sh_merge_master 2023-02-22 11:24:43 -08:00
Ralf W. Grosse-Kunstleve
7087a74add Revert "Appease new flake8 B028 error:"
This reverts commit 44c2d89c47.
2023-02-22 11:24:34 -08:00
Henry Schreiner
438034c5b8
chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
xkszltl
a19daeac16
Inconsistent comments between 2 templates of unchecked(). (#4519)
This comment is unrelated to having T in tparam or not.
Probably a typo.
Copied the correct one here.

Resolve https://github.com/pybind/pybind11/issues/4518
2023-02-20 14:58:37 -08:00
Henry Schreiner
68211d41c1
fix: nicer stack level for warning (#4516)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-02-17 17:13:29 -05:00
Ralf W. Grosse-Kunstleve
6a5e6007cd
Make warning suppressions MINGW-specific again. (#4515)
Background: https://github.com/pybind/pybind11/pull/4285#issuecomment-1435066554
2023-02-17 12:58:35 -08:00
Ralf W. Grosse-Kunstleve
d1956eabb5
Appease new flake8 B028 error: (#4513)
```
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

pybind11/setup_helpers.py:177:13: B028 No explicit stacklevel keyword argument found. The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user.
            warnings.warn("You cannot safely change the cxx_level after setting it!")
            ^
```
2023-02-17 12:31:08 -08:00
Ralf W. Grosse-Kunstleve
44c2d89c47 Appease new flake8 B028 error:
```
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

pybind11/setup_helpers.py:177:13: B028 No explicit stacklevel keyword argument found. The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user.
            warnings.warn("You cannot safely change the cxx_level after setting it!")
            ^
```
2023-02-16 22:43:34 -08:00
Ralf W. Grosse-Kunstleve
bb68819cdf Tracking ci.yml changes from master. 2023-02-16 15:03:38 -08:00
Ralf W. Grosse-Kunstleve
550d4b7490 Merge branch 'master' into sh_merge_master 2023-02-16 15:02:47 -08:00
Ralf W. Grosse-Kunstleve
f7587abb94 Revert "Temporarily remove pip.yml, to avoid GHA failures while waiting for a fix on master."
This reverts commit 3cef809281.
2023-02-16 15:01:45 -08:00
Ralf W. Grosse-Kunstleve
08a4a47a6c
Revert "Go back to CMake 3.25.2 (#4496)" (#4503)
* Revert "Go back to CMake 3.25.2 (#4496)"

This reverts commit b8f28551cc.

* Apply patch provided by @bradking (with pre-commit cmake-format auto fixes).

https://github.com/pybind/pybind11/pull/4503#issuecomment-1424768172
2023-02-16 10:54:57 -05:00
Henry Schreiner
535f81a1c0
fix: tests dir has started to show up in packaging (#4510)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-02-16 09:54:27 -05:00
Dustin Spicuzza
8dcced29ae
Always display python type information in cast errors (#4463)
* Always display python type information in cast errors

* Address comments

* Update comment
2023-02-09 21:21:17 -08:00
Mike Essenmacher
531144dddc
Replace "whitelist" with "allowlist" (#4506) 2023-02-09 10:11:01 -08:00
Ralf W. Grosse-Kunstleve
3cef809281 Temporarily remove pip.yml, to avoid GHA failures while waiting for a fix on master. 2023-02-07 23:56:34 -08:00
Ralf W. Grosse-Kunstleve
3d8e525766 Tracking ci.yml changes from master. 2023-02-07 23:55:18 -08:00
Ralf W. Grosse-Kunstleve
8c43d35210 Merge branch 'master' into sh_merge_master3 2023-02-07 23:54:04 -08:00
Ralf W. Grosse-Kunstleve
b8f28551cc
Go back to CMake 3.25.2 (#4496) 2023-02-07 20:19:33 -08:00
Ralf W. Grosse-Kunstleve
f8713ec43e
Revert "bugfix: Keep registered types until after Py_Finalize(). Fix #4459 (#4486)" (#4501)
This reverts commit b2c1978caa.

See #4500 for background.
2023-02-07 16:55:00 -08:00
pre-commit-ci[bot]
8a90b36772
chore(deps): update pre-commit hooks (#4495)
updates:
- [github.com/PyCQA/pylint: v2.16.0 → v2.16.1](https://github.com/PyCQA/pylint/compare/v2.16.0...v2.16.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-02-07 01:16:25 -05:00
Aaron Gokaslan
b2c1978caa
bugfix: Keep registered types until after Py_Finalize(). Fix #4459 (#4486)
* Keep registered types until after Py_Finalize(). Fix #4459

* Address reviewer comments
2023-02-06 11:36:05 -05:00
dependabot[bot]
9ef65cee0e
chore(deps): bump ilammy/msvc-dev-cmd from 1.12.0 to 1.12.1 (#4493)
Bumps [ilammy/msvc-dev-cmd](https://github.com/ilammy/msvc-dev-cmd) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/ilammy/msvc-dev-cmd/releases)
- [Commits](https://github.com/ilammy/msvc-dev-cmd/compare/v1.12.0...v1.12.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 00:16:52 -05:00
Aaron Gokaslan
08a89fac3a
bugfix: delete proper ctors in gil.h (#4490) 2023-02-04 13:40:13 -05:00
Henry Schreiner
3efe9d4cb5
chore: update to black 23 (#4482)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-02-01 14:23:37 -05:00
Daniel Jacobs
44e9368222
Use PyConfig_InitPythonConfig instead of PyConfig_InitIsolatedConfig (#4473)
* Use PyConfig_InitPythonConfig instead of PyConfig_InitIsolatedConfig

* add unit test for default python configuration

---------

Co-authored-by: Daniel Jacobs <daniel.jacobs@is4s.com>
2023-01-31 23:42:05 -08:00
Ralf W. Grosse-Kunstleve
c71e3af73f
Bump isort version to 5.12.0 (#4480) 2023-01-31 22:44:18 -08:00
Ralf W. Grosse-Kunstleve
a500f439d0
Resolve new flake8 error (#4462)
* Resolve flake8 error by replacing `pytest.raises(Exception)` with `SystemError`

* Also remove the obsolete comment.

* Tweak comment instead of removing it.
2023-01-19 10:48:46 -08:00
albanD
c709d2a83e
Make sure to properly untrack gc objects before freeing them (#4461)
* Make sure to properly untrack gc objects before freeing them

* style: pre-commit fixes

* Fix lint

* Add comment about where the original track comes from

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-01-18 12:11:26 -08:00