Inline multipart mark operations
This PR now stands alone against main; it does not require #369 to merge first. The earlier stacked changes are reverted in a new commit to preserve pushed history.
Replace set_mark and delete_mark with the same self.marks assignments and pop(..., None) calls, avoiding two function creations per write(). The net diff changes only python_multipart/multipart.py; callback extraction, header-size validation, tests, and workflows are unchanged from main.
Validation on Python 3.13.18: scripts/check, scripts/test --strict-config --strict-markers (185 tests, 100% coverage), and scripts/rename pass.
Local wall-clock microbenchmarks on CPython 3.13.18, macOS arm64, using the existing benchmark inputs (µs per parse; median of three interleaved comparisons, each taking the best of seven timeit batches):
| Input | main (9bd038e) | Standalone mark operations |
|---|---|---|
| Small form | 8.30 | 7.96 |
| Large form | 325.09 | 311.47 |
| 8 MB upload | 608.10 | 584.78 |
| Boundary-heavy data | 44.73 | 42.79 |
These small local differences do not establish a portable speedup; CodSpeed is the independent check.
Additional -W error testing exposes pre-existing unclosed-file warnings in test_upload_dir_with_leading_slash_in_filename, test_file_full_name, and test_file_full_name_with_ext. The same failures reproduce on main (9bd038e) with Python 3.13.18; they are not changed here.
Session: pi --session 01a1e0a2-78a9-7473-86ce-b992bd92cf74