Extract multipart data callbacks into a method
Move MultipartParser's data_callback closure into _data_callback, with data and length passed explicitly instead of captured on each write(). This takes one part of the proposal in #368, leaving the header-size checks and other closures unchanged. Pin the benchmark workflow to Python 3.13.18, the patch release used by the initial CI run, to prevent interpreter drift.
Add a public-API regression test for callback order and data across chunk boundaries, including failed boundary matches. Validation: scripts/check, scripts/test --strict-config --strict-markers (217 tests, 100% coverage), and scripts/rename pass.
Local microbenchmarks on CPython 3.13.4, macOS arm64 (µs per parse; median of three interleaved comparisons, each taking the best of seven timeit batches with the existing benchmark inputs):
| Input | main | Extraction only | Change |
|---|---|---|---|
| Small form | 8.39 | 7.99 | -4.8% |
| Large form | 336.69 | 326.89 | -2.9% |
| 8 MB upload | 575.58 | 567.51 | -1.4% |
| Boundary-heavy data | 44.43 | 44.52 | +0.2% |
These are local microbenchmark results, not end-to-end request timings. The initial CodSpeed simulation reported no performance change across all five benchmarks, so a portable speedup is not established.
Session: pi --session 01a1e0a2-78a9-7473-86ce-b992bd92cf74