Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TypeVarTuple repr
  • Loading branch information
youknowone committed Jun 25, 2025
commit af7f1797d26d587e2e64b139c40f24c8dcc27ba5
10 changes: 9 additions & 1 deletion vm/src/stdlib/typing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ pub(crate) mod _typing {
default_value: parking_lot::Mutex<PyObjectRef>,
evaluate_default: PyObjectRef,
}
#[pyclass(flags(HAS_DICT), with(Constructor))]
#[pyclass(flags(HAS_DICT), with(Constructor, Representable))]
impl TypeVarTuple {
#[pygetset(magic)]
fn name(&self) -> PyObjectRef {
Expand Down Expand Up @@ -701,6 +701,14 @@ pub(crate) mod _typing {
}
}

impl Representable for TypeVarTuple {
#[inline(always)]
fn repr_str(zelf: &crate::Py<Self>, vm: &VirtualMachine) -> PyResult<String> {
let name = zelf.name.str(vm)?;
Ok(format!("*{}", name))
}
}

pub(crate) fn make_typevartuple(name: PyObjectRef, vm: &VirtualMachine) -> TypeVarTuple {
TypeVarTuple {
name,
Expand Down