jnorwoo / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Shed Skin crashes when converting to C++ #203

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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

Original issue reported on code.google.com by thelum...@yahoo.co.uk on 29 Apr 2014 at 4:42

GoogleCodeExporter commented 8 years ago
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.

Original comment by mark.duf...@gmail.com on 30 Apr 2014 at 8:32