Inline-Python icon indicating copy to clipboard operation
Inline-Python copied to clipboard

Segfault in Inline::Python.new.run

Open moritz opened this issue 8 years ago • 0 comments

I've tried to write a test file about passing arrays to python functions:

#!/usr/bin/env perl6

use v6;
use Inline::Python;

use Test;
plan 2;

my $py = Inline::Python;

$py.run: q:to<EOP>;
def test_array(a):
    return ','.join(a)

def nested_join(*args):
    return ','.join([';'.join(e) for e in args])
EOP
is $py.call('__main__', 'test_array', ['a', 'b']), 'a,b', 'simple array';

is $py.call('__main__', 'nested_join', ['a', 'b'], $['c', 'd']),
   'a;b,c;d',
    'can pass arrays to slurpy argument';

It segfaults in the run method, afaict:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff41e6c6b in PyImport_GetModuleDict ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
(gdb) bt
#0  0x00007ffff41e6c6b in PyImport_GetModuleDict ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#1  0x00007ffff41ee960 in PyImport_AddModule ()
   from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#2  0x00007ffff46343f5 in py_eval (
    p=0x3d0e7a0 "def test_array(a):\n    return ','.join(a)\n\ndef nested_join(*args):\n    return ','.join([';'.join(e) for e in args])\n", type=1)
    at pyhelper.c:45
#3  0x00007ffff78a3630 in dcCall_x64_sysv ()
   from //home/moritz/p6/rakudo/install/lib/libmoar.so
#4  0x00000000006037c0 in ?? ()
#5  0x00007fffffffd480 in ?? ()
#6  0x00007ffff78a3569 in dc_callvm_call_x64 ()
   from //home/moritz/p6/rakudo/install/lib/libmoar.so
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Feel free to use the test file if it makes sense :-)

moritz avatar Mar 11 '17 11:03 moritz