Repository navigation
Conversation
cexprtk's Symbol_Table.__dealloc__ writes through attributes that its tp_clear has already reset to None, so freeing a Symbol_Table through the cyclic garbage collector overwrites memory next to the None object. pydantic 2.14.4 lets the collector free reference cycles that pass through a ValidationError, which made this crash the test suite on CI. Remove Symbol_Table's tp_clear when ccflow first imports cexprtk, so such cycles are broken through other objects and the table is freed by reference counting. Signed-off-by: Pascal Tomecek <40371786+ptomecek@users.noreply.github.com>
Contributor
Test Results 1 files ±0 1 suites ±0 2m 28s ⏱️ -9s Results for commit 90c7091. ± Comparison against base commit 58ae11d. This pull request skips 4 and un-skips 1 tests.♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #301 +/- ##
==========================================
- Coverage 93.89% 93.63% -0.27%
==========================================
Files 205 205
Lines 23126 23158 +32
Branches 1517 1519 +2
==========================================
- Hits 21715 21683 -32
- Misses 1119 1181 +62
- Partials 292 294 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
The test suite segfaults on most CI jobs with pydantic 2.14.4. The cause is in cexprtk:
Symbol_Table.__dealloc__writes through attributes that the type's GC clear function has already set toNone, so aSymbol_Tablefreed by the cyclic garbage collector overwrites memory next to theNoneobject. Whether and where that crashes depends on the interpreter build. Every cexprtk release up to 0.4.2 has this__dealloc__. pydantic 2.14.4 (pydantic/pydantic#14253) lets the collector free reference cycles that pass through aValidationError, so aSymbol_Tableheld by a test frame is now freed this way.When ccflow first imports cexprtk, it removes the GC clear function from
Symbol_Table, which is what@cython.no_gc_clearwould do upstream. The collector then breaks these cycles through the other objects, and the table is freed by reference counting with its attributes intact. The patch applies only to default CPython builds and only after confirming the slot holds the expected function. It can be removed once cexprtk ships a fix.Once ccflow has imported cexprtk, the change applies to every
Symbol_Tablein the process, including tables created by user code.