Ralf W. Grosse-Kunstleve
e3ebb0dbca
Slightly rewording comment. (There were also other failures.)
2022-05-13 00:17:22 -07:00
Ralf W. Grosse-Kunstleve
2ad22854dc
Go back to replacing the held Python exception with then normalized exception, if & when needed. Consistently document the side-effect.
2022-05-13 00:11:17 -07:00
Ralf W. Grosse-Kunstleve
bab6f668e1
For Python < 3.8: PyErr_NormalizeException
before PyErr_WriteUnraisable
2022-05-12 14:26:01 -07:00
Ralf W. Grosse-Kunstleve
7578de9c48
Use gil_scoped_acquire_local
in error_already_set
destructor. See long comment.
2022-05-12 13:02:36 -07:00
Ralf W. Grosse-Kunstleve
d28c155c1d
clang-tidy: use auto
2022-05-12 02:00:43 -07:00
Ralf W. Grosse-Kunstleve
02df6c0114
Normalize the exception only locally in error_string(). Python 3.6 & 3.7 test failures expected. This is meant for benchmarking, to determine if it is worth the trouble looking into the failures.
2022-05-12 01:30:20 -07:00
Ralf W. Grosse-Kunstleve
b020e04275
Remove mutable (fixes oversight in the previous commit).
2022-05-12 00:29:04 -07:00
Ralf W. Grosse-Kunstleve
4193375ed6
Change error_already_set() to call pybind11_fail() if the Python error indicator not set. The net result is that a std::runtime_error is thrown instead of error_already_set, but all tests pass as is.
2022-05-11 23:59:14 -07:00
Ralf W. Grosse-Kunstleve
dded0243a4
Putting back the two eager PyErr_NormalizeException() calls.
2022-05-11 23:20:30 -07:00
Ralf W. Grosse-Kunstleve
90b2453cbd
bug fix: error_string(PyObject **, ...)
2022-05-11 03:48:08 -07:00
Ralf W. Grosse-Kunstleve
58ad49b05e
Various changes.
2022-05-11 02:35:01 -07:00
Ralf W. Grosse-Kunstleve
acdf332cda
Make expected error message less specific.
2022-05-10 18:42:39 -07:00
Ralf W. Grosse-Kunstleve
80b05ba663
Fix clang-tidy error [performance-move-constructor-init].
2022-05-10 18:39:53 -07:00
Ralf W. Grosse-Kunstleve
498195ac4b
Replace extremely opaque (unhelpful) error message with a truthful reflection of what we know.
2022-05-10 18:22:50 -07:00
Ralf W. Grosse-Kunstleve
de84a27fd4
Bug fix: Remove what();
from restore()
.
...
It sure would need to be guarded by `if (m_type)`, otherwise `what()` fails and masks that no error was set (see update unit test). But since `error_already_set` is copyable, there is no point in releasing m_type, m_value, m_trace, therefore we can just as well avoid the runtime overhead of force-building `m_lazy_what`, it may never be used.
2022-05-10 17:59:27 -07:00
Ralf W. Grosse-Kunstleve
c7a7146875
Make a comment slightly less ambiguous.
2022-05-10 17:47:48 -07:00
Ralf W. Grosse-Kunstleve
28de959fa4
consistently check m_lazy_what.empty() also in production builds
2022-05-10 17:09:32 -07:00
Ralf W. Grosse-Kunstleve
0691d5f58d
detail::obj_class_name(), fprintf with [STDERR], [STDOUT] tags, polish comments
2022-05-10 16:38:27 -07:00
Ralf W. Grosse-Kunstleve
a8f7a9797e
Merge branch 'lazy-error-string' of https://github.com/superbobry/pybind11 into lazy-error-string
2022-05-10 16:22:28 -07:00
Ralf W. Grosse-Kunstleve
1c8398f635
Merge branch 'master' into lazy-error-string
2022-05-10 16:22:03 -07:00
pre-commit-ci[bot]
ad146b2a18
[pre-commit.ci] pre-commit autoupdate ( #3933 )
...
updates:
- [github.com/asottile/pyupgrade: v2.32.0 → v2.32.1](https://github.com/asottile/pyupgrade/compare/v2.32.0...v2.32.1 )
- [github.com/pre-commit/mirrors-clang-format: v14.0.1 → v14.0.3](https://github.com/pre-commit/mirrors-clang-format/compare/v14.0.1...v14.0.3 )
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-09 18:44:21 -04:00
Aaron Gokaslan
0aee425b3b
Clang-Tidy fix
2022-05-08 10:46:23 -04:00
Aaron Gokaslan
20312253d2
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy-error-string
2022-05-08 10:44:56 -04:00
Aaron Gokaslan
1f8f0ab4c5
Remove unnecessary include
2022-05-08 10:44:45 -04:00
Aaron Gokaslan
6e781a0383
Apply reviewer suggestions, simplify code, and make helper method private
2022-05-08 10:42:46 -04:00
Aaron Gokaslan
2e331308d3
chore: remove unused include from stl.h ( #3928 )
...
* change iostream include to ostream include
2022-05-06 16:57:39 -04:00
Aaron Gokaslan
f181dace8e
default ctor is noexcept too
2022-05-06 14:39:59 -04:00
Aaron Gokaslan
4da996878e
Try explicit ctor
2022-05-06 14:28:35 -04:00
Aaron Gokaslan
8f6ab3f16f
Try specifying noexcept again
2022-05-06 13:45:17 -04:00
Ralf W. Grosse-Kunstleve
f4a440a8f9
Report "FATAL failure building pybind11::error_already_set error_string" and terminate process.
2022-05-05 14:20:30 -07:00
Ralf W. Grosse-Kunstleve
226cddea49
Merge branch 'master' into lazy-error-string
2022-05-05 14:17:45 -07:00
Ed Catmur
68a0b2dfd8
Add anyset & frozenset, enable copying (cast) to std::set ( #3901 )
...
* Add frozenset, and allow it cast to std::set
For the reverse direction, std::set still casts to set. This is in concordance with the behavior for sequence containers, where e.g. tuple casts to std::vector but std::vector casts to list.
Extracted from #3886 .
* Rename set_base to any_set to match Python C API
since this will be part of pybind11 public API
* PR: static_cast, anyset
* Add tests for frozenset
and rename anyset methods
* Remove frozenset default ctor, add tests
Making frozenset non-default constructible means that we need to adjust pyobject_caster to not require that its value is default constructible, by initializing value to a nil handle. This also allows writing C++ functions taking anyset, and is arguably a performance improvement, since there is no need to allocate an object that will just be replaced by load.
Add some more tests, including anyset::empty, anyset::size, set::add and set::clear.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add rationale to `pyobject_caster` default ctor
* Remove ineffectual protected: access control
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-05 12:09:56 -07:00
pre-commit-ci[bot]
9a16e55ad2
[pre-commit.ci] pre-commit autoupdate ( #3903 )
...
updates:
- [github.com/hadialqattan/pycln: v1.3.1 → v1.3.2](https://github.com/hadialqattan/pycln/compare/v1.3.1...v1.3.2 )
- [github.com/PyCQA/pylint: v2.13.5 → v2.13.8](https://github.com/PyCQA/pylint/compare/v2.13.5...v2.13.8 )
- [github.com/pre-commit/mirrors-mypy: v0.942 → v0.950](https://github.com/pre-commit/mirrors-mypy/compare/v0.942...v0.950 )
2022-05-05 15:02:16 -04:00
Aaron Gokaslan
d32bc917df
Remove unnecessary mutable
2022-05-04 13:48:17 -04:00
HaarigerHarald
f306012b55
fix: file extension on windows with cp36 and cp37 ( #3919 )
2022-05-04 13:12:33 -04:00
Aaron Gokaslan
e0d8d0ec8b
See if we still need debug
2022-05-04 13:05:02 -04:00
Aaron Gokaslan
a83028cd4a
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy-error-string
2022-05-04 13:03:41 -04:00
Aaron Gokaslan
bdc7dd8c31
chore: update NVIDIA-PGI CI workflow ( #3922 )
...
* Update PGI workflow
* Remove copy paste typo
* ci: fix debian image
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-05-04 13:02:07 -04:00
Aaron Gokaslan
e9a2e6d013
Revert operator abuse
2022-05-03 10:40:48 -04:00
Ralf W. Grosse-Kunstleve
287e4f233d
Test pickling a simple callable (does not work). ( #3906 )
...
* Test pickling a simple callable (does not work).
Currently only documents that it does not work. Starting point for future fix.
* Use re.search to accommodate variations of the TypeError message.
* PyPy: exercise full dumps/loads cycle.
* Adding explicit "broken" comment.
2022-05-02 12:39:36 -07:00
Michael Voznesensky
f0b9f755e4
Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES ( #3913 )
...
* Update cast.h
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Move definition to detail/common, change name, apply everywhere
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename debug_enabled in tests to detailed_error_messages_enabled
2022-05-02 15:30:19 -04:00
Aaron Gokaslan
75007dda72
chore: rule of 3 for strdup guard ( #3905 )
2022-04-26 15:49:24 -04:00
Ed Catmur
9bc2704430
Add tests for cast from tuple to sequence containers ( #3900 )
...
We already test that tuple can cast to std::vector and std::deque; add tests for std::vector<bool>, std::list and
std::valarray.
Extracted from #3886 .
2022-04-24 14:39:47 -07:00
dependabot[bot]
03252067db
chore(deps): bump actions/upload-artifact from 2 to 3 ( #3899 )
...
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact ) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases )
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: actions/upload-artifact
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-04-24 16:49:41 -04:00
dependabot[bot]
be4a634c67
chore(deps): bump actions/checkout from 2 to 3 ( #3896 )
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](https://github.com/actions/checkout/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: actions/checkout
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-04-24 16:49:13 -04:00
Aaron Gokaslan
82455a41fd
Minor opt to cache tuple casting ( #3894 )
2022-04-24 14:46:39 -04:00
dependabot[bot]
2a7cb008ac
chore(deps): bump actions/download-artifact from 2 to 3 ( #3897 )
...
Bumps [actions/download-artifact](https://github.com/actions/download-artifact ) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases )
- [Commits](https://github.com/actions/download-artifact/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: actions/download-artifact
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-04-24 14:41:23 -04:00
dependabot[bot]
e79293cf2f
chore(deps): bump actions/cache from 2 to 3 ( #3898 )
...
Bumps [actions/cache](https://github.com/actions/cache ) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases )
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md )
- [Commits](https://github.com/actions/cache/compare/v2...v3 )
---
updated-dependencies:
- dependency-name: actions/cache
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-04-24 14:41:09 -04:00
dependabot[bot]
b58b772b46
chore(deps): bump actions/setup-python from 2 to 3 ( #3895 )
...
Bumps [actions/setup-python](https://github.com/actions/setup-python ) from 2 to 3.
- [Release notes](https://github.com/actions/setup-python/releases )
- [Commits](https://github.com/actions/setup-python/compare/v2...v3 )
---
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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-24 14:40:58 -04:00
Henry Schreiner
1a8603e479
ci: dependabot major versions for official actions ( #3888 )
...
* ci: dependabot major versions for official actions
* style: use extend-select for flake8
2022-04-24 13:50:29 -04:00