add missing python binding for filenames::file_name() - #8886
Merged
Merged
Conversation
Changed Files
|
ABI check against
|
|
| Branch | filenames-py-bindings |
| Testbed | ubuntu-24.04 |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result nanoseconds (ns) (Result Δ%) | Upper Boundary nanoseconds (ns) (Limit %) |
|---|---|---|---|
| base-v1.torrent | 📈 view plot 🚷 view threshold | 44,334.31 ns(-26.69%)Baseline: 60,477.24 ns | 87,155.51 ns (50.87%) |
| base-v2.torrent | 📈 view plot 🚷 view threshold | 81,352.18 ns(-23.54%)Baseline: 106,401.40 ns | 148,610.13 ns (54.74%) |
| dh_compute_secret | 📈 view plot 🚷 view threshold | 33,008.29 ns(-10.04%)Baseline: 36,691.98 ns | 46,851.39 ns (70.45%) |
| dh_handshake | 📈 view plot 🚷 view threshold | 66,255.24 ns(-9.43%)Baseline: 73,150.75 ns | 94,580.11 ns (70.05%) |
| dh_key_exchange | 📈 view plot 🚷 view threshold | 33,109.00 ns(-9.44%)Baseline: 36,560.00 ns | 47,129.95 ns (70.25%) |
| ip_filter: access, hit | 📈 view plot 🚷 view threshold | 51.98 ns(-20.46%)Baseline: 65.36 ns | 89.08 ns (58.35%) |
| ip_filter: access, miss | 📈 view plot 🚷 view threshold | 51.38 ns(-20.37%)Baseline: 64.52 ns | 88.17 ns (58.28%) |
| many-pad-files.torrent | 📈 view plot 🚷 view threshold | 910,079.10 ns(-22.23%)Baseline: 1,170,166.46 ns | 1,605,435.01 ns (56.69%) |
| merkle: compute root | 📈 view plot 🚷 view threshold | 138,854.68 ns(-40.36%)Baseline: 232,815.35 ns | 523,342.24 ns (26.53%) |
| merkle: create proof | 📈 view plot 🚷 view threshold | 105.36 ns(-19.56%)Baseline: 130.98 ns | 169.91 ns (62.01%) |
| merkle: validate proof | 📈 view plot 🚷 view threshold | 1,648.80 ns(-37.86%)Baseline: 2,653.48 ns | 5,716.81 ns (28.84%) |
| piece picker: add/remove near-seed | 📈 view plot 🚷 view threshold | 171,800.21 ns(-13.36%)Baseline: 198,303.27 ns | 242,409.52 ns (70.87%) |
| piece picker: add/remove seed | 📈 view plot 🚷 view threshold | 24.81 ns(-11.06%)Baseline: 27.90 ns | 37.68 ns (65.85%) |
| piece picker: break one seed | 📈 view plot 🚷 view threshold | 107,324.24 ns(-9.63%)Baseline: 118,754.96 ns | 165,022.52 ns (65.04%) |
| piece picker: get availability | 📈 view plot 🚷 view threshold | 13,652.34 ns(-19.61%)Baseline: 16,982.10 ns | 25,122.57 ns (54.34%) |
| piece picker: mark as downloading, high index | 📈 view plot 🚷 view threshold | 81.04 ns(-14.74%)Baseline: 95.04 ns | 119.96 ns (67.55%) |
| piece picker: mark as downloading, low index | 📈 view plot 🚷 view threshold | 1,347.20 ns(-14.65%)Baseline: 1,578.44 ns | 2,271.61 ns (59.31%) |
| piece picker: pick pieces, after dirty | 📈 view plot 🚷 view threshold | 847,840.46 ns(-9.99%)Baseline: 941,983.43 ns | 1,253,959.68 ns (67.61%) |
| piece picker: pick pieces, clean | 📈 view plot 🚷 view threshold | 36.04 ns(-16.02%)Baseline: 42.92 ns | 51.97 ns (69.36%) |
| piece picker: pick pieces, dense peer | 📈 view plot 🚷 view threshold | 37.49 ns(-13.25%)Baseline: 43.22 ns | 52.71 ns (71.14%) |
| piece picker: pick pieces, sparse peer | 📈 view plot 🚷 view threshold | 227,549.90 ns(-34.31%)Baseline: 346,378.34 ns | 770,655.95 ns (29.53%) |
| piece picker: piece priorities | 📈 view plot 🚷 view threshold | 14,249.70 ns(-21.22%)Baseline: 18,088.69 ns | 23,620.29 ns (60.33%) |
| piece picker: refcount bitfield, 1 bit set | 📈 view plot 🚷 view threshold | 165,899.19 ns(-12.16%)Baseline: 188,862.59 ns | 248,278.24 ns (66.82%) |
| piece picker: refcount bitfield, 10 bits set | 📈 view plot 🚷 view threshold | 171,662.51 ns(-9.45%)Baseline: 189,586.49 ns | 252,169.25 ns (68.07%) |
| piece picker: refcount bitfield, 200 bits set | 📈 view plot 🚷 view threshold | 173,239.75 ns(-10.12%)Baseline: 192,748.93 ns | 249,231.47 ns (69.51%) |
| piece picker: refcount bitfield, 49 bits set | 📈 view plot 🚷 view threshold | 173,957.92 ns(-8.90%)Baseline: 190,957.49 ns | 251,415.04 ns (69.19%) |
| piece picker: refcount bitfield, 50 bits set | 📈 view plot 🚷 view threshold | 166,479.04 ns(-12.58%)Baseline: 190,443.41 ns | 252,592.72 ns (65.91%) |
| piece picker: refcount bitfield, 5000 bits set | 📈 view plot 🚷 view threshold | 168,119.87 ns(-14.52%)Baseline: 196,686.07 ns | 264,831.19 ns (63.48%) |
| rc4_encrypt | 📈 view plot 🚷 view threshold | 24,433.96 ns(-21.53%)Baseline: 31,136.85 ns | 45,384.38 ns (53.84%) |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Adds the missing Python binding for filenames.file_name(), with C++ support, type stubs, and tests.
Changes:
- Adds the
filenames::file_name()forwarding method. - Exposes
file_name(index)in the Python API and stubs. - Tests renamed, unrenamed, and invalid-index behavior.
| File | Description |
|---|---|
include/libtorrent/file_storage.hpp |
Adds the filenames view method. |
bindings/python/src/file_storage.cpp |
Registers the Python binding. |
bindings/python/libtorrent/__init__.pyi |
Adds the type-stub declaration. |
bindings/python/tests/torrent_handle_test.py |
Tests expected behavior and validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
arvidn
force-pushed
the
filenames-py-bindings
branch
from
September 20, 2026 22:52
7142112 to
a74bfa2
Compare
arvidn
force-pushed
the
filenames-py-bindings
branch
from
September 21, 2026 00:07
a74bfa2 to
ab4e12f
Compare
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.
No description provided.