Skip to content

Commit a555ce4

Browse files
Copilotyouknowone
andcommitted
Format str constructor fast path
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
1 parent 0852fa6 commit a555ce4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

crates/vm/src/builtins/str.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,7 @@ impl Constructor for PyStr {
395395

396396
fn slot_new(cls: PyTypeRef, func_args: FuncArgs, vm: &VirtualMachine) -> PyResult {
397397
// Optimization: for exact str, return PyObject_Str result as-is
398-
if cls.is(vm.ctx.types.str_type)
399-
&& func_args.args.len() == 1
400-
&& func_args.kwargs.is_empty()
398+
if cls.is(vm.ctx.types.str_type) && func_args.args.len() == 1 && func_args.kwargs.is_empty()
401399
{
402400
return func_args.args[0].str(vm).map(Into::into);
403401
}

0 commit comments

Comments
 (0)