Skip to content

Commit

Permalink
test_embedding: Remove broken tests returning arrays from kernels
Browse files Browse the repository at this point in the history
This is a use-after-free issue (by the time __modinit sends back
the return value, the array allocated on the stack of the interior
function is already dead) allowed only by mistake, presumably due
to GitHub issue m-labs#1497 or a similar bug.
  • Loading branch information
dnadlinger committed Jan 20, 2021
1 parent 5dda269 commit 5faa30a
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions artiq/test/coredevice/test_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,7 @@ def args1kwargs2(self):

@kernel
def numpy_things(self):
return (numpy.int32(10), numpy.int64(20), numpy.array([42,]))

@kernel
def numpy_full(self):
return numpy.full(10, 20)

@kernel
def numpy_full_matrix(self):
return numpy.full((3, 2), 13)

@kernel
def numpy_nan(self):
return numpy.full(10, numpy.nan)
return (numpy.int32(10), numpy.int64(20))

@kernel
def builtin(self):
Expand Down Expand Up @@ -284,10 +272,7 @@ def test_args(self):
self.assertEqual(exp.kwargs2(), 2)
self.assertEqual(exp.args1kwargs2(), 2)
self.assertEqual(exp.numpy_things(),
(numpy.int32(10), numpy.int64(20), numpy.array([42,])))
self.assertTrue((exp.numpy_full() == numpy.full(10, 20)).all())
self.assertTrue((exp.numpy_full_matrix() == numpy.full((3, 2), 13)).all())
self.assertTrue(numpy.isnan(exp.numpy_nan()).all())
(numpy.int32(10), numpy.int64(20)))
exp.builtin()
exp.async_in_try()

Expand Down

0 comments on commit 5faa30a

Please sign in to comment.