Conversation
| /// the function with a particular signature, and a mismatch is UB.) | ||
| #[macro_export] | ||
| #[cfg(Py_3_15)] | ||
| macro_rules! PySlot_FUNC { |
There was a problem hiding this comment.
It's also possible to do this with a sealed trait but that felt magical and complicated for a tiny bit of type safety that felt questionably useful to me, in practice. Please let me know if you'd prefer I not launder an unsafe transmute inside a macro like this.
Merging this PR will improve performance by 12.89%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | bench_pyclass_create |
4.6 µs | 4.1 µs | +12.89% |
Comparing ngoldbaum:pep-820 (117205b) with main (f57bda7)
Footnotes
-
1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩
|
I added 3.15 and 3.15t CI to the PR CI builds and the new CI is passing. I just rebased and squashed to get a better coverage report. (EDIT: I guess it makes sense the coverage CI is failing, given the new untested FFI definitions) That said, this is definitely ready for review. Please let me know if you'd prefer I do this in smaller chunks. |
towards fixing #6012.
Adds support for the PEP 820 PySlot API, updates the PEP 793 implementation, and adds the critical section API to the limited API. Also fixes a small change to PyTypeObject that crept in since alpha8.
Claude helped a bit for code review and to figure out the
PySlot_FUNCand the__pyo3_pymodexportmacros.Ping @bschoenmaeckers because you asked in the issue what this would look like.