Skip to content

Commit d41e46b

Browse files
committed
remove is_typevar duplciation
1 parent 73364fa commit d41e46b

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

vm/src/builtins/union.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,10 @@ pub fn is_unionable(obj: PyObjectRef, vm: &VirtualMachine) -> bool {
139139
|| obj.class().is(vm.ctx.types.union_type)
140140
}
141141

142-
fn is_typevar(obj: &PyObjectRef, vm: &VirtualMachine) -> bool {
143-
let class = obj.class();
144-
"TypeVar" == &*class.slot_name()
145-
&& class
146-
.get_attr(identifier!(vm, __module__))
147-
.and_then(|o| o.downcast_ref::<PyStr>().map(|s| s.as_str() == "typing"))
148-
.unwrap_or(false)
149-
}
150-
151142
fn make_parameters(args: &PyTupleRef, vm: &VirtualMachine) -> PyTupleRef {
152143
let mut parameters: Vec<PyObjectRef> = Vec::with_capacity(args.len());
153144
for arg in args {
154-
if is_typevar(arg, vm) {
145+
if genericalias::is_typevar(arg, vm) {
155146
if !parameters.iter().any(|param| param.is(arg)) {
156147
parameters.push(arg.clone());
157148
}

0 commit comments

Comments
 (0)