-
Notifications
You must be signed in to change notification settings - Fork 2.2k
error_already_set::what() is now constructed lazily #1895
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
Merged
Merged
Changes from all commits
Commits
Show all changes
136 commits
Select commit
Hold shift + click to select a range
87d1f6b
error_already_set::what() is now constructed lazily
superbobry e289e0e
Do not attempt to normalize if no exception occurred
superbobry f1435c7
Extract exception name via tp_name
superbobry 60df143
Reverted error_already_set to subclass std::runtime_error
superbobry c935b73
Revert "Extract exception name via tp_name"
superbobry b48bc72
Cosmit following @YannickJadoul's comments
superbobry 115a757
Fixed PyPy build
superbobry db14dd9
Moved normalization to error_already_set ctor
superbobry 9635e88
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy…
Skylion007 dbb3e6b
Fix merge bugs
Skylion007 a692362
Fix more merge errors
Skylion007 ff3185e
Improve formatting
Skylion007 95eeaef
Improve error message in rare case
Skylion007 00e4852
Revert back if statements
Skylion007 648e670
Fix clang-tidy
Skylion007 244aa52
Try removing mutable
Skylion007 b09f14d
Does build_mode release fix it
Skylion007 1d1ec9e
Set to Debug to expose segfault
Skylion007 6d0354b
Fix remove set error string
Skylion007 2c5ad0b
Do not run error_string() more than once
Skylion007 68b349a
Trying setting the tracebackk to the value
Skylion007 91bf33f
guard if m_type is null
Skylion007 63dfbb4
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy…
Skylion007 d231f15
Try to debug PGI
Skylion007 df6cb30
One last try for PGI
Skylion007 bdcd95a
Does reverting this fix PyPy
Skylion007 225dbae
Reviewer suggestions
Skylion007 f8d3ed2
Remove unnecessary initialization
Skylion007 b90bd78
Add noexcept move and explicit fail throw
Skylion007 3286964
Optimize error_string creation
Skylion007 978bf2a
Fix typo
Skylion007 6c97e68
Revert noexcept
Skylion007 6523bc2
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy…
Skylion007 6c6971f
Fix merge conflict error
Skylion007 98aff18
t pushMerge branch 'master' of https://github.com/pybind/pybind11 int…
Skylion007 e71d9b9
Abuse assignment operator
Skylion007 e9a2e6d
Revert operator abuse
Skylion007 a83028c
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy…
Skylion007 e0d8d0e
See if we still need debug
Skylion007 d32bc91
Remove unnecessary mutable
Skylion007 226cdde
Merge branch 'master' into lazy-error-string
rwgk f4a440a
Report "FATAL failure building pybind11::error_already_set error_stri…
rwgk 8f6ab3f
Try specifying noexcept again
Skylion007 4da9968
Try explicit ctor
Skylion007 f181dac
default ctor is noexcept too
Skylion007 6e781a0
Apply reviewer suggestions, simplify code, and make helper method pri…
Skylion007 1f8f0ab
Remove unnecessary include
Skylion007 2031225
Merge branch 'master' of https://github.com/pybind/pybind11 into lazy…
Skylion007 0aee425
Clang-Tidy fix
Skylion007 1c8398f
Merge branch 'master' into lazy-error-string
rwgk a8f7a97
Merge branch 'lazy-error-string' of https://github.com/superbobry/pyb…
rwgk 0691d5f
detail::obj_class_name(), fprintf with [STDERR], [STDOUT] tags, polis…
rwgk 28de959
consistently check m_lazy_what.empty() also in production builds
rwgk c7a7146
Make a comment slightly less ambiguous.
rwgk de84a27
Bug fix: Remove `what();` from `restore()`.
rwgk 498195a
Replace extremely opaque (unhelpful) error message with a truthful re…
rwgk 80b05ba
Fix clang-tidy error [performance-move-constructor-init].
rwgk acdf332
Make expected error message less specific.
rwgk 58ad49b
Various changes.
rwgk 90b2453
bug fix: error_string(PyObject **, ...)
rwgk dded024
Putting back the two eager PyErr_NormalizeException() calls.
rwgk 4193375
Change error_already_set() to call pybind11_fail() if the Python erro…
rwgk b020e04
Remove mutable (fixes oversight in the previous commit).
rwgk 02df6c0
Normalize the exception only locally in error_string(). Python 3.6 & …
rwgk d28c155
clang-tidy: use auto
rwgk 7578de9
Use `gil_scoped_acquire_local` in `error_already_set` destructor. See…
rwgk bab6f66
For Python < 3.8: `PyErr_NormalizeException` before `PyErr_WriteUnrai…
rwgk 2ad2285
Go back to replacing the held Python exception with then normalized e…
rwgk e3ebb0d
Slightly rewording comment. (There were also other failures.)
rwgk 8dff51d
Add 1-line comment for obj_class_name()
rwgk 923725a
Benchmark code, with results in this commit message.
rwgk 53f40a0
Changing call_repetitions_target_elapsed_secs to 0.1 for regular unit…
rwgk b77e703
Adding in `recursion_depth`
rwgk 493d751
Optimized ctor
Skylion007 6d0ec49
Merge branch 'lazy-error-string' of https://github.com/superbobry/pyb…
Skylion007 6d9188f
Fix silly bug in recurse_first_then_call()
rwgk 8f3d3a6
Add tests that have equivalent PyErr_Fetch(), PyErr_Restore() but no …
rwgk 724ee3d
Add call_error_string to tests. Sample only recursion_depth 0, 100.
rwgk 467ab00
Show lazy-what speed-up in percent.
rwgk eaa1a48
Include real_work in benchmarks.
rwgk dbed20a
Replace all PyErr_SetString() with generate_python_exception_with_tra…
rwgk f021543
Better organization of test loops.
rwgk 125e2d0
Add test_error_already_set_copy_move
rwgk b037958
Fix bug in newly added test (discovered by clang-tidy): actually use …
rwgk 2baa3bc
MSVC detects the unreachable return
rwgk 4c479f4
change test_perf_error_already_set.py back to quick mode
rwgk b4326f9
Inherit from std::exception (instead of std::runtime_error, which doe…
rwgk aaec34e
Special handling under Windows.
rwgk 99af318
print with leading newline
rwgk e5f028f
Merge branch 'master' into lazy-error-string
rwgk 8c76360
Removing test_perf_error_already_set (copies are under https://github…
rwgk c7149d8
Avoid gil and scope overhead if there is nothing to release.
rwgk 47f5445
Restore default move ctor. "member function" instead of "function" (n…
rwgk 7c08e7f
Delete error_already_set copy ctor.
rwgk f746a3d
Make restore() non-const again to resolve clang-tidy failure (still e…
rwgk 25e4cc9
Bring back error_already_set copy ctor, to see if that resolves the 4…
rwgk 70b870a
Add noexcept to error_already_set copy & move ctors (as suggested by …
rwgk d425bb8
Trying one-by-one noexcept copy ctor for old compilers.
rwgk 65aaa4c
Add back test covering copy ctor. Add another simple test that exerci…
rwgk 19bb595
Exclude more older compilers from using the noexcept = default ctors.…
rwgk d07b5ba
Factor out & reuse gil_scoped_acquire_local as gil_scoped_acquire_simple
rwgk f6bf5aa
Guard gil_scoped_acquire_simple by _Py_IsFinalizing() check.
rwgk cc5d76a
what() GIL safety
rwgk 2b31e4d
clang-tidy & Python 3.6 fixes
rwgk 73cffe4
Merge branch 'master' into lazy-error-string
rwgk 2c5dd19
Use `gil_scoped_acquire` in dtor, copy ctor, `what()`. Remove `_Py_Is…
rwgk 14be38c
Remove error_scope from copy ctor.
rwgk db97ce7
Add `error_scope` to `get_internals()`, to cover the situation that `…
rwgk 42d2e1a
Add `FlakyException` tests with failure triggers in `__init__` and `_…
rwgk 6417a76
Tweaks to resolve Py 3.6 and PyPy CI failures.
rwgk a62b3d7
Normalize Python exception immediately in error_already_set ctor.
rwgk c54309c
Merge branch 'master' into lazy-error-string
rwgk c786796
Fix oversights based on CI failures (copy & move ctor initialization).
rwgk 61bb513
Move @pytest.mark.xfail("env.PYPY") after @pytest.mark.parametrize(...)
rwgk bb3f24c
Use @pytest.mark.skipif (xfail does not work for segfaults, of course).
rwgk 087ef29
Merge branch 'master' into lazy-error-string
rwgk bee5fb4
Remove unused obj_class_name_or() function (it was added only under t…
rwgk bea0c9f
Remove already obsolete C++ comments and code that were added only un…
rwgk d6d371a
Slightly better (newly added) comments.
rwgk eec0547
Factor out detail::error_fetch_and_normalize. Preparation for produci…
rwgk ec1a2c0
Copy most of error_string() code to new error_fetch_and_normalize::co…
rwgk c39ebd5
Remove all error_string() code from detail/type_caster_base.h. Note t…
rwgk 286023b
Return const std::string& instead of const char * and move error_stri…
rwgk 156b57b
Remove gil_scope_acquire from error_fetch_and_normalize, add back to …
rwgk 6f175ac
Better handling of FlakyException __str__ failure.
rwgk 71f33a8
Move error_fetch_and_normalize::complete_lazy_error_string() implemen…
rwgk 0739d4c
Add error_fetch_and_normalize::release_py_object_references() and use…
rwgk 80dfaea
Use shared_ptr for m_fetched_error => 1. non-racy, copy ctor that doe…
rwgk a7ba693
Add comments.
rwgk 9854589
Trivial renaming of a newly introduced member function.
rwgk d2e78b0
Merge branch 'master' into lazy-error-string
rwgk 0e50c45
Workaround for PyPy
rwgk 4e06fb1
Bug fix (oversight). Only valgrind got this one.
rwgk f892cce
Use shared_ptr custom deleter for m_fetched_error in error_already_se…
rwgk 53e29f4
Further small simplification. With the GIL held, simply deleting the …
rwgk 8e145c0
IWYU cleanup
rwgk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.