Export to GitHub

shedskin - issue #203

Shed Skin crashes when converting to C++


Posted on Apr 29, 2014 by Helpful Horse

When I try to convert https://github.com/ZirconiumX/sunfish/blob/master/sunfish.py to C++ the Shed Skin compiler crashes.

[matthew@localhost sunfish]$ shedskin -a sunfish.py * SHED SKIN Python-to-C++ Compiler 0.9.4 * Copyright 2005-2011 Mark Dufour; License GNU GPL version 3 (See LICENSE)

[analyzing types..] ********************************100% [generating c++ code..] Traceback (most recent call last): File "/usr/bin/shedskin", line 3, in <module> shedskin.main() File "/usr/lib/python2.7/site-packages/shedskin/init.py", line 138, in main start(gx, main_module_name) File "/usr/lib/python2.7/site-packages/shedskin/init.py", line 128, in start generate_code(gx) File "/usr/lib/python2.7/site-packages/shedskin/cpp.py", line 2715, in generate_code gv.header_file() File "/usr/lib/python2.7/site-packages/shedskin/cpp.py", line 248, in header_file self.visit(self.module.ast, True) File "/usr/lib/python2.7/compiler/visitor.py", line 57, in dispatch return meth(node, *args) File "/usr/lib/python2.7/site-packages/shedskin/cpp.py", line 570, in visitModule self.module_hpp(node) File "/usr/lib/python2.7/site-packages/shedskin/cpp.py", line 348, in module_hpp self.class_hpp(child) File "/usr/lib/python2.7/site-packages/shedskin/cpp.py", line 711, in class_hpp self.class_variables(cl) File "/usr/lib/python2.7/site-packages/shedskin/cpp.py", line 807, in class_variables self.output(nodetypestr(self.gx, var, cl, mv=self.mv) + self.cpp_name(var) + ';') File "/usr/lib/python2.7/site-packages/shedskin/typestr.py", line 119, in nodetypestr return typestr(gx, types, None, cplusplus, node, check_extmod, 0, check_ret, var, mv=mv) File "/usr/lib/python2.7/site-packages/shedskin/typestr.py", line 124, in typestr ts = typestrnew(gx, types, cplusplus, node, check_extmod, depth, check_ret, var, tuple_check, mv=mv) File "/usr/lib/python2.7/site-packages/shedskin/typestr.py", line 193, in typestrnew elif not node or infer.inode(gx, node).mv.module.builtin: AttributeError: 'NoneType' object has no attribute 'module'

Arch Linux 64 bit using Shed Skin 0.9.4

Matthew:out

Comment #1

Posted on Apr 30, 2014 by Happy Camel

thanks for reporting and the interesting program. I'm tempted to try and add this to the shedskin example set.

this problem has been fixed in git shortly after releasing 0.9.4. unfortunately there are not enough other improvements since to do a 0.9.5 release.

the problem occurs typically for programs containing actual dynamic types, so it may be a bit more work to get it work. also I see the program seems to be a heavy tuple user (for moves), which doesn't translate very well to fast C++ code.

Status: New

Labels:
Type-Defect Priority-Medium