Repository navigation
Conversation
sobolevn
reviewed
Nov 5, 2026
Author
|
Addressed in c10e2e7: the error now reports the received type ( |
sobolevn
reviewed
Nov 5, 2026
sobolevn
reviewed
Nov 5, 2026
sobolevn
left a comment
Member
There was a problem hiding this comment.
Please, assert that after the exception is handled: context var must not be cleared. Its value must not change
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn
reviewed
Nov 5, 2026
sobolevn
approved these changes
Nov 5, 2026
skirpichev
approved these changes
Nov 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs gh-161387.
_decimal.current_context()returned whatever the internaldecimal_contextContextVarheld, without checkingPyDecContext_Check. Callers immediately cast the value toPyDecContextObject *, so setting the variable to a non-context (for example1) segfaults on the next decimal operation.Raise
TypeErrorfromcurrent_context()when the stored value is not a context.CURRENT_CONTEXTalready propagatesNULL, so callers fail cleanly.Tests: new
CContextAPItests.test_current_context_var_wrong_type. Built current main (5aa2f705) with the C_decimalextension (libmpdec 2.5.1): the reproducer exits with SIGSEGV (rc=139) before the change and raisesTypeErrorafter. The new test and the fulltest_decimalsuite (751 tests, 9 skipped) pass.