cy99 / shedskin

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

inheritance from builtins is not supported #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. shedskin g_encode.py
2.
3.

What is the expected output? What do you see instead?

success.

*ERROR* g_encode.py:24: inheritance from builtins is not supported

What version of the product are you using? On what operating system?
SHED SKIN Python-to-C++ Compiler 0.0.28 ***
Ubuntu linux

Please provide any additional information below.

 The problem code is this:

class BadFormatError(RuntimeError):
        def __init__(self, *x):
                RuntimeError.__init__(self, *x)

Unfortunately, this kind of thing is essential if one is going
to do much of anything with exceptions.

Original issue reported on code.google.com by gpk...@gmail.com on 29 Jul 2008 at 12:06

GoogleCodeExporter commented 8 years ago
thanks for the reports ^^

in order to get anywhere with shed skin, I have had to initially disable 
support for
some basic Python features, such as inheriting from builtins, and varargs. these
limitations are both mentioned in the tutorial, I think. 

in the future, we'll have to see which currently unsupported features can be
supported. simple inheritance like this should probably be easy to support. 
varargs
will be a bit more difficult..

anyway, I get the feeling you'd like to use shed skin for arbitrary programs. 
this
won't ever work (theoretically even), and I don't think we want to give up on 
all
these fancy Python features and libraries. 

the best use of shed skin at this point is to compile not too complicated 
extension
modules (shedskin -e, see the readme :P), or relatively small programs. if you
compile an extension module, you can still use all the fancy Python features and
libraries, and get a nice speedup for some heavy-duty calculation. 

Original comment by mark.duf...@gmail.com on 30 Jul 2008 at 8:10

GoogleCodeExporter commented 8 years ago
I will have a look later at inheriting from builtin exceptions, though.

Original comment by mark.duf...@gmail.com on 30 Jul 2008 at 8:10

GoogleCodeExporter commented 8 years ago
> I get the feeling you'd like to use shed skin for arbitrary programs. this
> won't ever work (theoretically even)...

Yes and no.   I was going through the low-level general-purpose modules I've
written and seeing how many of them ShedSkin could compile, and which ones
it could handle with minimal modifications.

The thing is, though, I wouldn't want to change the API they offer,
and exceptions are very much part of a module's API.    So, I am looking
forward to eventual support of inheritance from exceptions.

Original comment by gpk...@gmail.com on 31 Jul 2008 at 9:14

GoogleCodeExporter commented 8 years ago
this now works, so I'm closing the issue:

class BadFormatError(RuntimeError):
        def __init__(self, x):
                RuntimeError.__init__(self, x)

not that the varargs is still not supported, but this is mentioned in the 
tutorial.

thanks again for reporting!

Original comment by mark.duf...@gmail.com on 27 Nov 2008 at 4:56