Remove CFFI in favor of native extension to support free-threaded mode#96
Remove CFFI in favor of native extension to support free-threaded mode#96adriencaccia wants to merge 4 commits intomasterfrom
Conversation
CodSpeed Performance ReportMerging #96 will degrade performances by 24.69%Comparing Summary
Benchmarks breakdown
|
Sounds good. I can't wait to see if this will pass on through or not. |
It seems that there is an issue when running In the runner we are setting the following: Do you know if there is any issue with free-threaded python and using |
@adriencaccia Sorry for my rather late response but there is one called |
Removed cffi package version 1.17.1 and its dependencies from the lock file.
33c1bfa to
411adc2
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates from CFFI-based Python bindings to native CPython extension module to enable free-threaded Python support. The change removes the CFFI dependency and replaces it with a hand-written C extension module that wraps the existing instrument hooks library.
Key changes:
- Removed CFFI dependency and replaced with native C extension API
- Added new C module
instrument_hooks_module.cimplementing Python bindings using CPython's C API - Updated
InstrumentHooksclass to use the new native module instead of CFFI'slibobject - Modified callgrind function calls to be methods on
InstrumentHooksinstead oflibproperties
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pytest_codspeed/instruments/valgrind.py | Updated callgrind instrumentation calls to use instance methods instead of lib object |
| src/pytest_codspeed/instruments/hooks/instrument_hooks_module.c | New native C extension module implementing Python bindings for instrument hooks |
| src/pytest_codspeed/instruments/hooks/build.py | Removed CFFI build configuration file |
| src/pytest_codspeed/instruments/hooks/init.py | Refactored to use native extension module and added callgrind methods |
| setup.py | Replaced CFFI extension with native Extension setup |
| pyproject.toml | Removed CFFI dependency and updated package data configuration |
| .github/workflows/ci.yml | Added Python 3.14t (free-threaded) to test matrix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Don't manually deinit - let the capsule destructor handle it | ||
| pass |
There was a problem hiding this comment.
The __del__ method with only a pass statement and comment should be removed entirely. An empty __del__ method can prevent proper garbage collection and the capsule destructor will be called automatically without defining __del__.
Fix #86