avoid vm.new_stringref in pystr.rs

This commit is contained in:
Jeong YunWon
2021-08-12 20:58:38 +09:00
committed by GitHub
parent 06d33f8f2c
commit 201664ed4f

View File

@@ -337,8 +337,7 @@ impl PyStr {
// This only works for `str` itself, not its subclasses.
return zelf;
}
vm.ctx
.new_stringref(zelf.value.repeat(value.to_usize().unwrap_or(0)))
Self::from(zelf.value.repeat(value.to_usize().unwrap_or(0))).into_ref(vm)
}
#[pymethod(magic)]