10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e906ee1 commit 47c8d26Copy full SHA for 47c8d26
vm/eval.go
@@ -900,7 +900,17 @@ func do_IMPORT_NAME(vm *Vm, namei int32) {
900
// subsequently stored by a STORE_FAST instruction.
901
func do_IMPORT_FROM(vm *Vm, namei int32) {
902
defer vm.CheckException()
903
- vm.NotImplemented("IMPORT_FROM", namei)
+ name := vm.frame.Code.Names[namei]
904
+ module := vm.TOP()
905
+ res, err := py.GetAttrErr(module, name)
906
+ if err != nil {
907
+ // Catch AttributeError and rethrow as ImportError
908
+ if py.IsException(py.AttributeError, err) {
909
+ err = py.ExceptionNewf(py.ImportError, "cannot import name %s", name)
910
+ }
911
+ vm.SetException(py.MakeException(err))
912
913
+ vm.PUSH(res)
914
}
915
916
// Increments bytecode counter by delta.
0 commit comments