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
Update
  • Loading branch information
carbotaniuman committed Dec 11, 2020
commit a6afbdf91191d4a13fc80ff356efd7ee82ac50f6
9 changes: 3 additions & 6 deletions vm/src/builtins/pytype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use super::pystr::PyStrRef;
use super::staticmethod::PyStaticMethod;
use super::tuple::PyTuple;
use super::weakref::PyWeak;
use crate::builtins::tuple::PyTupleRef;
use crate::builtins::tuple::{PyTupleRef, PyTupleTyped};
use crate::function::{FuncArgs, KwArgs};
use crate::pyobject::{
BorrowValue, Either, IdProtocol, PyAttributes, PyClassImpl, PyContext, PyIterable, PyLease,
Expand Down Expand Up @@ -418,13 +418,10 @@ impl PyType {
}));
}

let (name, bases, dict, kwargs): (PyStrRef, PyTupleRef, PyDictRef, KwArgs) =
let (name, bases, dict, kwargs): (PyStrRef, PyTupleTyped<PyTypeRef>, PyDictRef, KwArgs) =
args.clone().bind(vm)?;

// TODO: This is kind of a hack because we lose type information only to redo it
let bases: PyIterable<PyTypeRef> =
PyIterable::try_from_object(vm, bases.into_object()).unwrap();
let bases: Vec<PyTypeRef> = bases.iter(vm)?.collect::<Result<Vec<_>, _>>()?;
let bases = bases.borrow_value().iter().cloned().collect::<Vec<_>>();
let (metatype, base, bases) = if bases.is_empty() {
let base = vm.ctx.types.object_type.clone();
(metatype, base.clone(), vec![base])
Expand Down