Skip to content

Commit f462f64

Browse files
committed
Rename maketrans's first parameter to frm
`from` is a Python keyword, so the generated signature could not be parsed: >>> bytes.maketrans.__text_signature__ '(from, to, /)' >>> inspect.signature(bytes.maketrans) ValueError: builtin has invalid signature CPython's Argument Clinic spells it `frm` for the same reason. Both parameters are positional-only, so the name is documentation only. `bytes.maketrans` and `bytearray.maketrans` now report what CPython reports, `(frm, to, /)`. Assisted-by: Claude Code:claude-opus-5
1 parent 0bae5c0 commit f462f64

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎crates/vm/src/builtins/bytearray.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ impl PyByteArray {
252252
}
253253

254254
#[pystaticmethod]
255-
fn maketrans(from: PyBytesInner, to: PyBytesInner, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
256-
PyBytesInner::maketrans(from, to, vm)
255+
fn maketrans(frm: PyBytesInner, to: PyBytesInner, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
256+
PyBytesInner::maketrans(frm, to, vm)
257257
}
258258

259259
#[pymethod]

‎crates/vm/src/builtins/bytes.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ impl PyBytes {
250250
}
251251

252252
#[pystaticmethod]
253-
fn maketrans(from: PyBytesInner, to: PyBytesInner, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
254-
PyBytesInner::maketrans(from, to, vm)
253+
fn maketrans(frm: PyBytesInner, to: PyBytesInner, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
254+
PyBytesInner::maketrans(frm, to, vm)
255255
}
256256

257257
fn __getitem__(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult {

0 commit comments

Comments
 (0)