Skip to content

Commit af7f179

Browse files
committed
TypeVarTuple repr
1 parent 23aa9e0 commit af7f179

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

vm/src/stdlib/typing.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ pub(crate) mod _typing {
607607
default_value: parking_lot::Mutex<PyObjectRef>,
608608
evaluate_default: PyObjectRef,
609609
}
610-
#[pyclass(flags(HAS_DICT), with(Constructor))]
610+
#[pyclass(flags(HAS_DICT), with(Constructor, Representable))]
611611
impl TypeVarTuple {
612612
#[pygetset(magic)]
613613
fn name(&self) -> PyObjectRef {
@@ -701,6 +701,14 @@ pub(crate) mod _typing {
701701
}
702702
}
703703

704+
impl Representable for TypeVarTuple {
705+
#[inline(always)]
706+
fn repr_str(zelf: &crate::Py<Self>, vm: &VirtualMachine) -> PyResult<String> {
707+
let name = zelf.name.str(vm)?;
708+
Ok(format!("*{}", name))
709+
}
710+
}
711+
704712
pub(crate) fn make_typevartuple(name: PyObjectRef, vm: &VirtualMachine) -> TypeVarTuple {
705713
TypeVarTuple {
706714
name,

0 commit comments

Comments
 (0)