Repository navigation
etas: keep filter structs alive on PyPy and remove all old filters in set_filters - #2171
Merged
Merged
Conversation
zariiii9003
force-pushed
the
fix-etas-pypy-filters
branch
from
November 29, 2026 23:21
9a5c64d to
5510532
Compare
3 of 10 tasks
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.
Summary of Changes
Two bugs in
EtasBus._apply_filters:OCI_CANRxFilterExstructs. Assigning.contentskeeps the struct alive on CPython but not on PyPy, so after garbage collection the array pointed to freed memory and BOA received corrupted filters.set_filters: the previously installed filters were removed with a fixedcountof1. Per the BOA OCI header (ocicanio.h,OCI_RemoveCANFrameFilterEx),countis the number of entries in the filter array, so only the first old filter was removed and the others stayed active.Related Issues / Pull Requests
test/test_etas.py, whose tests fail intermittently on the PyPy CI job because of the first bug)Type of Change
Checklist
tox).Additional Notes
Evidence
PyPy filter structs,
test/test_etas.pyon PyPy 3.12 with agc.collect()forced before the fake library reads the filters:test_constructor_filters_are_installedreads garbage such as(758445430, 2376409665, 0, 0);test_set_filters_replaces_constructor_filtersraisesValueError). The same failures occurred without the forced GC on themacos-latest, pypy312CI job.set_filtersremove count,test_set_filters_replaces_constructor_filtersnow starts with two constructor filters:[(0x124, 0x7FF, 0, 4), (0x456, 0x7FF, 0, 4)] != [(0x456, 0x7FF, 0, 4)]🤖 Generated with AI