Skip to content

Commit 3c01628

Browse files
Merge pull request #490 from schaefed/master
Fixes #489
2 parents 727dd5e + d397fd8 commit 3c01628

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pixie/vm/numbers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def to_float(x):
320320
return rt.wrap(float(x.int_val()))
321321
if isinstance(x, BigInteger):
322322
return rt.wrap(x.bigint_val().tofloat())
323-
assert False
323+
object.runtime_error(u"Cannot convert %s to float" %x.type().name())
324324

325325
def to_float_conv(c):
326326
if c == Float:

tests/pixie/tests/test-ffi.pxi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
(t/assert= 0.5 (asinf (sinf 0.5)))
4949
(t/assert= 1.0 (+ (powf (sinf 0.5) 2.0) (powf (cosf 0.5) 2.0))))
5050

51+
(t/deftest test-invalid-float-argument
52+
(t/assert-throws? (m/sin "nil"))
53+
(t/assert-throws? (m/sin nil))
54+
)
5155

5256
(t/deftest test-ffi-callbacks
5357
(let [MAX 255

0 commit comments

Comments
 (0)