We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'import' takes incorrect arguments and it crashes gpython. we test the following code on Gopherjs and Go/wasm online.
test.py
__import__( 'pkg', {}, {}, [''] )
Output on GO/wasm(https://gpython.org/?wasm):
Gpython 3.4.0 running in your browser with go/wasm >>> __import__( 'pkg', {}, {}, [''] ) panic: interface conversion: py.Object is *py.List, not py.Tuple goroutine 5 [running]: github.com/go-python/gpython/py.BuiltinImport(0x0, 0x0, 0xc040420, 0x4, 0x4, 0x0, 0xc062db0, 0x0, 0x0, 0x0, ...) /home/ncw/go/src/github.com/go-python/gpython/py/import.go:394 +0x18 github.com/go-python/gpython/vm.callInternal(0x9d360, 0xc02ab80, 0xc040420, 0x4, 0x4, 0x0, 0xc0a40b0, 0x0, 0x0, 0x0, ...) /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1595 +0x25 github.com/go-python/gpython/vm.(*Vm).Call(0xc074540, 0x4, 0x0, 0x0, 0x0, 0x0, 0xc05ea60, 0xc040410) /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1689 +0x4e github.com/go-python/gpython/vm.do_CALL_FUNCTION(0xc074540, 0x4, 0x0, 0x0) /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1428 +0x2 github.com/go-python/gpython/vm.RunFrame(0xc0a40b0, 0x0, 0xc07bd18, 0x0, 0x0) /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:1785 +0x3f github.com/go-python/gpython/vm.EvalCodeEx(0xc04c200, 0xc062db0, 0xc062db0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2162 +0xa3 github.com/go-python/gpython/vm.Run(0xc062db0, 0xc062db0, 0xc04c200, 0x0, 0x0, 0x0, 0x0, 0x1, 0x9d240, 0xc04c200) /home/ncw/go/src/github.com/go-python/gpython/vm/eval.go:2182 +0x2 github.com/go-python/gpython/repl.(*REPL).Run(0xc09a6c0, 0xc038330, 0x21) /home/ncw/go/src/github.com/go-python/gpython/repl/repl.go:99 +0x20 main.main.func1(0xc01e3f0, 0x2, 0x2) /home/ncw/go/src/github.com/go-python/gpython/repl/web/main.go:82 +0x4 syscall/js.callbackLoop() /opt/go/go1.11/src/syscall/js/callback.go:116 +0x7 created by syscall/js.NewCallback.func1 /opt/go/go1.11/src/syscall/js/callback.go:40 +0x2 ...
Output on Gopherjs (https://gpython.org/)
>>> __import__( 'pkg', {}, {}, [''] ) [USER]: https://gpython.org/gpython.js: interface conversion: interface is *py.List, not py.Tuple $callDeferred@https://gpython.org/gpython.js:4:22511 $panic@https://gpython.org/gpython.js:4:22957 $assertType@https://gpython.org/gpython.js:4:21361 EP@https://gpython.org/gpython.js:41:219420 DN@https://gpython.org/gpython.js:44:81763 EE.ptr.prototype.Call@https://gpython.org/gpython.js:44:87109 DC@https://gpython.org/gpython.js:44:77098 DO@https://gpython.org/gpython.js:44:91592 DU@https://gpython.org/gpython.js:44:107450 DW@https://gpython.org/gpython.js:44:109015 G.ptr.prototype.Run@https://gpython.org/gpython.js:56:3575 $b@https://gpython.org/gpython.js:60:3908 $b@https://gpython.org/gpython.js:59:2625 r@https://gpython.org/gpython.js:4:23443 $runScheduled@https://gpython.org/gpython.js:4:24007 $schedule@https://gpython.org/gpython.js:4:24184 $go@https://gpython.org/gpython.js:4:23907 I/$packages["github.com/gopherjs/gopherwasm/js"]<@https://gpython.org/gpython.js:59:2240 $externalizeFunction/e.$externalizeWrapper@https://gpython.org/gpython.js:4:28925 a@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:82615 k@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:83463 ENTER@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:14915 $e@https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/1.23.2/js/jquery.terminal.min.js:40:28362 dispatch@https://code.jquery.com/jquery-latest.js:4641:9 add/elemData.handle@https://code.jquery.com/jquery-latest.js:4309:28 ...
The text was updated successfully, but these errors were encountered:
This looks like unchecked type assertions...
gpython/py/import.go
Line 356 in 6f8e06a
In fact we should probably just be catching these and turning them into a TypeError as there are loads of them in the code base.
I see in 4b9bdd5 we removed those checks. Maybe we need to put some of them back. Perhaps just the one in CALL_FUNCTION
Sorry, something went wrong.
No branches or pull requests
'import' takes incorrect arguments and it crashes gpython. we test the following code on Gopherjs
and Go/wasm online.
test.py
__import__( 'pkg', {}, {}, [''] )
Output on GO/wasm(https://gpython.org/?wasm):
Output on Gopherjs (https://gpython.org/)
The text was updated successfully, but these errors were encountered: