getsmatu / shedskin Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/shedskin
Automatically exported from code.google.com/p/shedskin
The attached patch implements just enough to get @staticmethod decorator
working. Namely, the following code compiles:
class C:
@staticmethod
def id(x):
return x
print C.id(1)
Original issue reported on code.google.com by sanxiyn
on 6 Aug 2008 at 8:28
Attachments:
What steps will reproduce the problem?
1.i type script code: a = input()
2. when i compile i have the error unbound interfinied 'input'
3. why i have this error ? sorry for my english i'm french
What is the expected output? What do you see instead?
nothing
What version of the product are you using? On what operating system?
python 2.6 and shedskin 0.30
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 12 Jan 2009 at 1:05
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 [email protected]
on 29 Jul 2008 at 12:06
What steps will reproduce the problem?
1. create a big long number in a python code
2. shedskin it
3. run the c++ code
What is the expected output? What do you see instead?
Expected output is a big long number
I get negative int numbers intead
What version of the product are you using? On what operating system?
latest as on 7 Jan 2008
WinXP SP3
Please provide any additional information below.
Possible soln:
Implement gmp.
Original issue reported on code.google.com by [email protected]
on 7 Jan 2009 at 1:37
Out of the box, shedskin will fail to compile. This is because builtin.cpp
and sys.cpp are missing some necessary header includes.
builtin.cpp is missing "#include <cstring>". It needs this file because it
uses memcpy. sys.cpp is missing "#include <climits>". It needs this file
because it uses INT_MAX.
I am using g++ 4.3. Earlier versions of g++ were more forgiving when you
did not include necessary header files. g++ versions are becoming stricter
in that regard.
I'll add to this bug if I find any other cpp files missing includes.
Also, when building, I get a bunch of deprecation warnings that cloud the
output. Apparently, builtin.cpp includes ext/hash_map and ext/hash_set,
which are declared to be deprecated. They expect you to include
unordered_set and unordered_map instead. I'm not sure how far back these
new headers go, as in, I'm not sure which versions of g++ include these
headers. I recommend either upgrading to the new headers, or just adding
-Wno-deprecated to the CCFLAGS line.
I am using the latest stable version of shedskin (0.0.28) on a Debian
system, with g++ 4.3.
Original issue reported on code.google.com by [email protected]
on 23 Aug 2008 at 6:36
It's GPL. And when you compile python code with shedskin, it links against
shedskin's minimal python lib implementation. Which means whatever you
compile with shedskin must become GPL.
This will be problematic for anyone that wants to use this application in a
commercial environment or code that is already licensed under a license
that is not GPL compatible.
If the code is LPGL changes to shedskin must still get open sourced(LGPL
compatible license) but the code that gets linked to the shedskin
supporting python library can be any license.
Ps: Also have a look at
http://www.reddit.com/r/programming/comments/9rtsb/shedskin_an_experimental_pyth
on_to_c_compiler/
Original issue reported on code.google.com by ludolph%[email protected]
on 8 Oct 2009 at 6:51
Hello,
It would be nice to have support for the "with" statement introduced in
http://www.python.org/dev/peps/pep-0343/
It's available in CPython from version 2.5 (in the __future__
pseudo-module) and from version 2.6 (as a "normal" keyword).
Thanks,
Original issue reported on code.google.com by arkanosis
on 6 Jan 2010 at 10:25
I ran shedskin SVN HEAD on the following 4 line test program, and compiled
the resulting program:
def p(msg):
print msg
p(15)
p("hello")
The output from shedskin was as follows (and appears reasonable, as far as
I know):
*** SHED SKIN Python-to-C++ Compiler 0.0.27 ***
Copyright 2005-2008 Mark Dufour; License GNU GPL version 3 (See LICENSE)
(Please send bug reports here: [email protected])
[iterative type analysis..]
**
iterations: 2 templates: 29
template <class A> p
[generating c++ code..]
The output I expected from running the resulting "foo" program was:
15
hello
However, the actual output was:
15
134762048
I half expected shedskin to complain that this program was passing two
different types to the p() function - however, it appears to attempt to
handle this by making p into a template. Sadly, the attempt fails because
the code produced for the print assumes that the parameter is always an
integer.
I suppose that shedskin could reasonably report an error in this case, but
it would be lovely if it could handle it correctly. Whichever - the
current behaviour of silently producing incorrect code seems like a bug.
Original issue reported on code.google.com by [email protected]
on 24 Feb 2008 at 1:47
The attached program initializes a member to 0, and then later redefines
the member to a class instance. This is not allowed within the shedskin model.
However, it should give an error message rather than crashing.
Running shedskin gives this output:
Traceback (most recent call last):
File "/home/user/software/python/shedskin/shedskin-0.0.26-1/ss.py", line
6815, in <module>
main()
File "/home/user/software/python/shedskin/shedskin-0.0.26-1/ss.py", line
6811, in main
analysis(name)
File "/home/user/software/python/shedskin/shedskin-0.0.26-1/ss.py", line
6534, in analysis
analyze_virtuals()
File "/home/user/software/python/shedskin/shedskin-0.0.26-1/ss.py", line
5444, in analyze_virtuals
if [cl for cl in concrete_cl.ancestors_upto(abstract_cl) if ident in
cl.funcs and not cl.funcs[ident].inherited]:
File "/home/user/software/python/shedskin/shedskin-0.0.26-1/ss.py", line
108, in ancestors_upto
a = a.bases[0]
IndexError: list index out of range
Original issue reported on code.google.com by [email protected]
on 23 Jan 2008 at 5:40
Attachments:
What steps will reproduce the problem?
1. shed a python file with these contents:
if __name__=='__main__':
print int(4==2)
2. run make
What is the expected output? What do you see instead?
expected output is successful compilation, instead I saw:
C:/Documents and Settings/user/Desktop/shedskin/shedskin-
0.0.27/shedskin/lib/builtin.hpp: In function `int __shedskin__::__int(T)
[with T = bool]':
hmm.cpp:15: instantiated from here
C:/Documents and Settings/user/Desktop/shedskin/shedskin-
0.0.27/shedskin/lib/builtin.hpp:74: error: base operand of `->' is not a
pointer
make: *** [hmm.pyd] Error 1
What version of the product are you using? On what operating system?
shedskin 0.0.27
g++ 3.4.2 (mingw-special)
Windows XP SP2
Please provide any additional information below.
This is obviously a terse example of the failure.
Original issue reported on code.google.com by [email protected]
on 6 Mar 2008 at 2:10
What steps will reproduce the problem?
1. shedskin foo.py # (foo.py is attached)
2. look at type annotation in foo.ss.py
3.
What is the expected output? What do you see instead?
The expected output has the return type of foo.foo() being a
dictionary. Instead, it claims it is an iter of sequence of strings.
What version of the product are you using? On what operating system?
0.0.28 xubuntu 8.04
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 31 Jul 2008 at 9:27
Attachments:
What steps will reproduce the problem?
1. I created this simple test.py program:
#!/usr/bin/python
suma = 0
for i in range(0,10000,2):
suma += i
print suma
2. The output of this program is 24995000, same as the output of the
shedskin C++ compiled version of the program.
3. However, the output is not the same when the range is increased to 100000.
What is the expected output? What do you see instead?
The expected output with a 100000 iterations loop is 2499950000 as the
python program will output if you run it. The shedskin version of the
modified program shows, on the oher hand, -1795017296.
I have to say that in the first case, shedskin provided a speedup of 20X,
which was pretty nice but, in the second case, it was python who knew how
to handle the bigger value and still output the correct computation.
What version of the product are you using? On what operating system?
shedskin_0.2-0ubuntu1_all-1.deb on Ubuntu 9.04
Please provide any additional information below.
Initializing "suma" to 0.0 instead of 0 makes the output of shedskin go
from "int suma" to "double suma" but the output remains the same.
Keep up the good work,
Carlos
Original issue reported on code.google.com by [email protected]
on 7 Oct 2009 at 1:54
This 2 patches add 2 new exeptions (ImportError and AttributeError), so
some more programs can be compiled...
Furthermore, while typing them in, I notice that currently e.g.
EOFException is declared twice in lib/builtin.py
With reordered according to alphabeth, that would not happened…
(-> Second patch)
What version of the product are you using? On what operating system?
trunk
Original issue reported on code.google.com by [email protected]
on 23 Aug 2009 at 5:13
Attachments:
Hello everybody
I'm Damiano from Italy, i'm really interested to your project, I'm a Python
developer and i'm studing C++ too (but i'm new of this language).
I have any questions:
- How could i to contact the ShedSkin Author? i read his blog but i don't
saw his email.
- Where can I find an explanation of the project? How it works etc. etc.
- Could i help you to develop this project? i can study hard C++
Thanks su much
Have a good day
Bye bye
(excuse me, i'm English is not very good :))
Original issue reported on code.google.com by [email protected]
on 5 Apr 2008 at 9:02
What steps will reproduce the problem?
1. import sys
2. sys.exit("Program exits")
I'm testing this on Win XP. Shedskin 0.0.26 creates the .cpp and .hpp
files, but will not make them. Changing the string in sys.exit() to an
int, bypasses the problem.
Original issue reported on code.google.com by [email protected]
on 16 Jan 2008 at 1:31
What steps will reproduce the problem?
1. from gmisclib import foo
2. (Package gmisclib is a pure python package of modules containing foo.
It's on the PYTHONPATH, not right here, but python has no problem finding it.)
What is the expected output? What do you see instead?
Success.
*ERROR* avio.py:5: cannot locate module: gmisclib
What version of the product are you using? On what operating system?
0.0.28 on Ubuntu
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 29 Jul 2008 at 12:24
Creation of a shedskin package:
The setup.py was modified to create a execuable 'shedskin.py', that can be
symlinced to anywhere where needed. On later installs the executable will
be smaler, because the sys.path.append won't be needed at all.
Don't know what 'backward.py' and 'bert.py' are about... Can they be
ignored/deleted? They are looking like tests…
Original issue reported on code.google.com by [email protected]
on 6 Sep 2009 at 4:01
Attachments:
When a group is defined in a pattern, re.findall returns matches instead
the group.
e.g.
re.findall("ab (cd) ef", "ab cd ef gh")
CPython returns: ['cd']
Shedskin executable returns: ['ab cd ef']
Shedskin verison: 0.0.28
Original issue reported on code.google.com by [email protected]
on 8 Sep 2008 at 1:45
What steps will reproduce the problem?
1. create a big long number in a python code
2. shedskin it
3. run the c++ code
What is the expected output? What do you see instead?
Expected output is a big long number
I get negative int numbers intead
What version of the product are you using? On what operating system?
latest as on 7 Jan 2008
WinXP SP3
Please provide any additional information below.
Possible soln:
Implement gmp.
Original issue reported on code.google.com by [email protected]
on 7 Jan 2009 at 1:38
What steps will reproduce the problem?
1. a = input(' ')
2.
3.
What is the expected output? What do you see instead?
To be able to use the input statement. An error from shedskin saying
"*ERROR* age.py:1: unbound identifier 'input'"
What version of the product are you using? On what operating system?
I'm usig shedskin 0.1.1. On windows xp.
Please provide any additional information below.
Please help with this situation.
Original issue reported on code.google.com by [email protected]
on 20 Jun 2009 at 3:47
I tried to run "shedskin shekskin"^^
In any files are "import compiler".... But only needed in one module!
This patch corrects this (tests fixes for 0.2 and 0.2.1 are currently
failing here, but with master also -> no problem (maybe another problem))
Another bug is new:
running: shedskin cpp
*** SHED SKIN Python-to-C++ Compiler 0.2 ***
Copyright 2005-2009 Mark Dufour; License GNU GPL version 3 (See LICENSE)
*ERROR* shared.py:143: function/class redefinition is not supported ('class_')
"class_" is in shared.py and in builtin.py, possibly this is resulting this
error
Original issue reported on code.google.com by [email protected]
on 23 Aug 2009 at 5:26
Attachments:
when running shedskin with the python -3 flag, some things are deprecated.
This fixes at least the minor problems, but with python 3.0 the compiler
module will be removed and anything has to be rewritten with the ast module.
Original issue reported on code.google.com by [email protected]
on 29 Aug 2009 at 10:34
Attachments:
The attached program gives different output when run from python and when
run under shedskin.
An array of doubles is initialized with an integer, and the type conversion
doesn't work correctly.
It appears to be a problem with variadic functions and type conversions (in
the list constructor). See the attached vatest.cpp file.
One possible solution is to add explicit casts in the constructor call, eg
charges = (new list<double>(1,(double)6));
Original issue reported on code.google.com by [email protected]
on 7 Feb 2008 at 1:18
Attachments:
The results of random are not bit-identical between the Python interpreter
and compiled code. Only the lowest order bits are affected - the
difference is not visible with the default floating point output precision.
In lib/random.cpp, line 205
return (((a*67108864.0)+b)*(1.0/9.00719925474e+15));
This line should be (see Python 2.5.1 source, _randommodule.c)
return (((a*67108864.0)+b)*(1.0/9007199254740992.0));
The following program will demonstrate the issue (need to hack the
generated cpp to see the full precision).
import random
random.seed(123)
r = random.uniform(-1.0,1.0)
#print "%20.16"%r
print repr(r)
Original issue reported on code.google.com by [email protected]
on 28 Jan 2008 at 3:50
GC error message "Too many heap sections" after reading big files.
This happens with shedskin v0.1.1 and v0.2
OS: Win XP SP2
Shedskin version 0.2
Scenario:
Read a 6-7MB file contents into a buffer for about 40-50 times
e.g: f = open("my_big_file.bin", "rb")
buff = f.read()
buff.close()
A file called gc.txt is created in the current directory reporting "GC
Warning: Repated allocation of very large block..."
Given enough reads the GC crashes altogether along with the program.
Original issue reported on code.google.com by [email protected]
on 27 Jul 2009 at 2:13
Simple test case in attach.
make run [22:58]
g++ -O3 -pipe -fomit-frame-pointer -I. -I./lib ./lib/builtin.cpp sort.cpp
-lgc -o sort
sort.cpp: In function ‘__shedskin__::list<void*>*
__sort__::quicksort(__shedskin__::list<int>*)’:
sort.cpp:64: error: no matching function for call to
‘__shedskin__::list<void*>::__add__(__shedskin__::list<int>*)’
./lib/builtin.hpp:1478: note: candidates are: __shedskin__::list<T>*
__shedskin__::list<T>::__add__(__shedskin__::list<T>*) [with T = void*]
make: *** [sort] Ошибка 1
Original issue reported on code.google.com by [email protected]
on 17 Feb 2008 at 6:57
Attachments:
I saw this noted in the docs, but FWIW it's also the first thing I ran into
while trying to compile simplejson (saw it in BeautifulSoup as well). That
might be another good test case, since it's all text processing.
http://www.undefined.org/python/
Original issue reported on code.google.com by [email protected]
on 14 Sep 2008 at 5:52
What steps will reproduce the problem?
1. shedskin test.py
2.
3.
What is the expected output? What do you see instead?
expected: successful compilation or an error telling me I can't do this
instead:
Traceback (most recent call last):
File "/lfs1/chiang/pkg/shedskin-0.2/ss.py", line 433, in <module>
main()
File "/lfs1/chiang/pkg/shedskin-0.2/ss.py", line 430, in main
annotate()
File "/lfs1/chiang/pkg/shedskin-0.2/ss.py", line 216, in annotate
paste(callfunc.node, typesetreprnew(callfunc, inode(callfunc).parent,
False))
File "/lfs1/chiang/pkg/shedskin-0.2/ss.py", line 163, in paste
line = source[expr.lineno-1][:-1]
IndexError: list index out of range
What version of the product are you using? On what operating system?
0.2
Linux
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 12 Dec 2009 at 12:37
Attachments:
What steps will reproduce the problem?
1. make
This is the output on Fedora 11 x86_64:
g++ -O2 -pipe -Wno-deprecated -I.
-I/home/frafra/Scaricati/shedskin-0.1.1/lib
/home/frafra/Scaricati/shedskin-0.1.1/lib/sys.cpp
/home/frafra/Scaricati/shedskin-0.1.1/lib/builtin.cpp life_shed.cpp
/home/frafra/Scaricati/shedskin-0.1.1/lib/re.cpp -lgc -lpcre -o life_shed
/home/frafra/Scaricati/shedskin-0.1.1/lib/builtin.cpp:688: error:
‘uint32_t’ does not name a type
/home/frafra/Scaricati/shedskin-0.1.1/lib/builtin.cpp: In member function
‘virtual int __shedskin__::str::__hash__()’:
/home/frafra/Scaricati/shedskin-0.1.1/lib/builtin.cpp:738: error:
‘SuperFastHash’ was not declared in this scope
life_shed.cpp: In member function ‘virtual __shedskin__::tuple2<int, int>*
__life_shed__::__gen_product::next()’:
life_shed.cpp:228: error: cannot convert ‘__shedskin__::tuple2<void*,
void*>*’ to ‘__shedskin__::tuple2<int, int>*’ in return
make: *** [life_shed] Error 1
This is the output on Ubuntu Jaunty i386:
g++ -O2 -pipe -Wno-deprecated -I. -I/usr/lib/shedskin/lib
/usr/lib/shedskin/lib/sys.cpp /usr/lib/shedskin/lib/builtin.cpp life.cpp
/usr/lib/shedskin/lib/re.cpp -lgc -lpcre -o life
life.cpp: In member function ‘virtual __shedskin__::tuple2<int, int>*
__life__::__gen_product::next()’:
life.cpp:228: error: cannot convert ‘__shedskin__::tuple2<void*, void*>*’
to ‘__shedskin__::tuple2<int, int>*’ in return
make: *** [life] Errore 1
Here's my code. The first function (product) is a reimplementation for
shedskin of itertools.product, fully working.
I'm using shedskin 0.1.1 and no errors or warnings are visible during:
$ shedskin life_shed.py
Original issue reported on code.google.com by [email protected]
on 16 Jun 2009 at 6:31
Attachments:
What steps will reproduce the problem?
Generic Type example ( in the readme.html ) does not compile to an
extension module
What is the expected output? What do you see instead?
I'm guessing it should spit out a pyd, but instead I get:
C:\shedskin-0.1\shedskin>shedskin -e gtype_test.py
*** SHED SKIN Python-to-C++ Compiler 0.1 ***
Copyright 2005-2008 Mark Dufour; License GNU GPL version 3 (See LICENSE)
[iterative type analysis..]
***
iterations: 3 templates: 49
template <class A> class matrix
[generating c++ code..]
C:\shedskin-0.1\shedskin>make
g++ -O2 -pipe -Wno-deprecated -I. -IC:/shedskin-0.1/shedskin/lib
-Ic:/python25
/include -D__SS_BIND gtype_test.cpp
C:/shedskin-0.1/shedskin/lib/builtin.cpp C:/
shedskin-0.1/shedskin/lib/re.cpp -lgc -lpcre -shared -Lc:/python25/libs
-lpytho
n25 -o gtype_test.pyd
In file included from gtype_test.cpp:1:
gtype_test.hpp:41: error: expected constructor, destructor, or type
conversion b
efore '*' token
gtype_test.hpp:41: error: expected `;' before '*' token
gtype_test.cpp:34: error: using-declaration for non-member at class scope
gtype_test.cpp:34: error: expected `;' before '*' token
gtype_test.cpp: In function `PyObject* __gtype_test__::matrixNew(PyTypeObject*,
PyObject*, PyObject*)':
gtype_test.cpp:47: error: 'struct __gtype_test__::matrixObject' has no
member na
med '__ss_object'
gtype_test.cpp:47: error: `__gtype_test__::matrix' is not a type
gtype_test.cpp:48: error: 'struct __gtype_test__::matrixObject' has no
member na
med '__ss_object'
gtype_test.cpp:49: error: `matrix___init__' undeclared (first use this
function)
gtype_test.cpp:49: error: (Each undeclared identifier is reported only once for
each function it appears in.)
gtype_test.cpp: In function `void
__gtype_test__::matrixDealloc(__gtype_test__::
matrixObject*)':
gtype_test.cpp:56: error: 'struct __gtype_test__::matrixObject' has no
member na
med '__ss_object'
gtype_test.cpp: At global scope:
gtype_test.cpp:135: error: `template<class A> class __gtype_test__::matrix'
used
without template parameters
gtype_test.cpp: In function `PyObject* __gtype_test__::__to_py__()':
gtype_test.cpp:136: error: invalid use of `this' in non-member function
gtype_test.cpp:137: error: invalid use of `this' in non-member function
gtype_test.cpp:139: error: 'struct __gtype_test__::matrixObject' has no
member n
amed '__ss_object'
gtype_test.cpp:139: error: invalid use of `this' in non-member function
gtype_test.cpp:140: error: 'struct __gtype_test__::matrixObject' has no
member n
amed '__ss_object'
gtype_test.cpp: At global scope:
gtype_test.cpp:148: error: expected constructor, destructor, or type conversion
before '*' token
gtype_test.cpp:148: error: expected `;' before '*' token
make: *** [gtype_test.pyd] Error 1
It compiles fine to an exe. Code is below for convenience
class matrix:
def __init__(self, hop):
self.unit = hop
m1 = matrix([1])
m2 = matrix([1.0])
hope it is helpful :)
What version of the product are you using? On what operating system?
SS 0.1, WinXP 32-bit
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 24 Feb 2009 at 7:27
Script http://www.uselesspython.com/download.php?script_id=270 not work
because SS don't support nested function (but correctly identify this cases).
Simplest test case in attach.
Original issue reported on code.google.com by [email protected]
on 17 Feb 2008 at 6:43
Attachments:
http://www.uselesspython.com/download.php?script_id=264
Simple example in attach.
Other problem for this script use dynamic type model for some variables.
Original issue reported on code.google.com by [email protected]
on 17 Feb 2008 at 7:07
Attachments:
To reproduce, run shedskin on the following program and compile with GCC 4.3:
print 'Hello, world!'
The error is:
/home/tinuviel/svn/shedskin/lib/builtin.cpp: In function
‘__shedskin__::str* __shedskin__::__add_strs(int, ...)’:
/home/tinuviel/svn/shedskin/lib/builtin.cpp:624: error: ‘memcpy’ was not
declared in this scope
Due to header reorganization done in GCC 4.3, GCC no longer includes many
headers implicitly. To use memcpy, one must include cstring.
Suggested fix:
Index: lib/builtin.hpp
===================================================================
--- lib/builtin.hpp (revision 291)
+++ lib/builtin.hpp (working copy)
@@ -15,6 +15,7 @@
#include <fstream>
#include <sstream>
#include <cstdarg>
+#include <cstring>
#include <cmath>
#include <algorithm>
#include <iterator>
Thanks!
Original issue reported on code.google.com by sanxiyn
on 6 Aug 2008 at 8:17
I only tested the solution on the test.py, but that works.
What steps will reproduce the problem?
1. Install shedskin, local directory
2. ./shedskin test.py
3. make
4. ./test
What is the expected output? What do you see instead?
Python->C++ works:
glop-/Users/bblais/Desktop/shedskin-0.0.26-> ./shedskin test.py
*** SHED SKIN Python-to-C++ Compiler 0.0.26 ***
Copyright 2005-2008 Mark Dufour; License GNU GPL version 3 (See LICENSE)
(Please send bug reports here: [email protected])
[iterative type analysis..]
**
iterations: 2 templates: 25
[generating c++ code..]
==========
compilation works:
glop-/Users/bblais/Desktop/shedskin-0.0.26-> make
g++ -O3 -s -pipe -fomit-frame-pointer
-I/Users/bblais/Desktop/shedskin-0.0.26/lib
/Users/bblais/Desktop/shedskin-0.0.26/lib/builtin.cpp test.cpp -lgc -o test
===========
Running doesn't:
glop-/Users/bblais/Desktop/shedskin-0.0.26-> ./test
dyld: lazy symbol binding failed: lazy pointer not found
dyld: lazy pointer not found
zsh: trace trap ./test
What version of the product are you using? On what operating system?
OS X 10.4 (Tiger)
Please provide any additional information below.
Solution, for at least this file, is to remove the -s option and run strip manually, in Makefile:
CCFLAGS=-O3 -pipe -fomit-frame-pointer $(CPPFLAGS)
-I/Users/bblais/Desktop/shedskin-
0.0.26/lib
test: $(CPPFILES) $(HPPFILES)
$(CC) $(CCFLAGS) $(CPPFILES) $(LFLAGS) -o test
strip test
Original issue reported on code.google.com by [email protected]
on 16 Jan 2008 at 2:29
I am trying to compile BeautifulSoup and therefore sgmllib.py and then
markupbase.py (the latter 2 from the Python standard lib).
With some modifications I can get markupbase.py to generate C++ code.
However I couldn't get past this with sgmllib -- not sure what the problem is.
Attached is the diff of all 3 files. BeautifulSoup is a very useful
library, it's a bit slow, and it's all text processing, so I think it would
make a very good test case for shedskin. (Great project BTW!)
There are some other bugs I encountered as well (which you can see in the
diffs):
- RuntimeError not supported
- self.foo is not like self.__class__.foo as it is in Python
- *args not supported
- from __future__ import generators not supported (it would be nice to just
ignore this or something, a lot of code has it for compatibility)
shedskin-read-only$ ./shedskin sgmllib.py
*** SHED SKIN Python-to-C++ Compiler 0.0.29 ***
Copyright 2005-2008 Mark Dufour; License GNU GPL version 3 (See LICENSE)
(Please send bug reports here: [email protected])
Traceback (most recent call last):
File "/home/andy/svn/shedskin-read-only/ss.py", line 482, in <module>
main()
File "/home/andy/svn/shedskin-read-only/ss.py", line 477, in main
analysis(name)
File "/home/andy/svn/shedskin-read-only/ss.py", line 81, in analysis
gx.main_module = parse_module(gx.main_mod, ast)
File "/home/andy/svn/shedskin-read-only/graph.py", line 1540, in parse_module
mv.dispatch(mod.ast)
File "/home/andy/svn/shedskin-read-only/graph.py", line 56, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.5/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/andy/svn/shedskin-read-only/graph.py", line 324, in visitModule
self.visitFunction(func_copy, cl, inherited_from=ancestor)
File "/home/andy/svn/shedskin-read-only/graph.py", line 484, in visitFunction
self.visit(node.code, func)
File "/home/andy/svn/shedskin-read-only/graph.py", line 56, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.5/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/andy/svn/shedskin-read-only/graph.py", line 241, in visitStmt
self.visit(b, func)
File "/home/andy/svn/shedskin-read-only/graph.py", line 56, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.5/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/andy/svn/shedskin-read-only/graph.py", line 1118, in visitAssign
self.tuple_flow(lvalue, rvalue, func)
File "/home/andy/svn/shedskin-read-only/graph.py", line 1172, in tuple_flow
tvar = self.tempvar(lvalue, func)
File "/home/andy/svn/shedskin-read-only/graph.py", line 790, in tempvar
varname = self.tempcount[getgx().parent_nodes[node]]
KeyError: AssTuple([AssName('sectName', 'OP_ASSIGN'), AssName('j',
'OP_ASSIGN')])
Original issue reported on code.google.com by [email protected]
on 14 Sep 2008 at 5:28
Attachments:
If shedskin currently does not support an unknown python module, it exits
with "module not found".
With this patch, it tries to copy the module in a subdir "genmod" and tries
to compile it there. After that we can add this directory in the Makefile
so the programm can fetch the new module.cpp/.hpp from there.
The reason for generating "genmod" and not copy it to the lib dir is, that
anything from lib dir should be maintained and shipped by shedskin. But on
an installed system any other user should not be allowed to modify/add
files in this folder. Therefore this patch keeps anything in the local
folder in "genmod" (another better name proposal is welcomed^^).
Original issue reported on code.google.com by [email protected]
on 23 Aug 2009 at 5:20
Attachments:
What steps will reproduce the problem?
1. Create a script that uses time.sleep()
2. shedskin.bat <script>; make
3. Monitor CPU utilization of the script
What version of the product are you using? On what operating system?
0.1 on Windows XP
Original issue reported on code.google.com by [email protected]
on 19 Feb 2009 at 4:14
What steps will reproduce the problem?
1. tar cvf shedskin-0.0.28.tgz
2. cp shedskin ~/bin
3. cd ../somewhere
4. shedskin vectorD.py
5. make
What is the expected output? What do you see instead?
I expect to see compliation. Instead, I see lots of error
messages indicating that some library is unavailable.
> $ make
> g++ -O3 -pipe -fomit-frame-pointer -I.
-I/home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib
/home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib/builtin.cpp vectorD.cpp -lgc
-o vectorD
> In file included from
/home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib/builtin.cpp:1:
> /home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib/builtin.hpp:8:29: error:
gc/gc_allocator.h: No such file or directory
> /home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib/builtin.hpp:9:23: error:
gc/gc_cpp.h: No such file or directory
> In file included from
/home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib/builtin.cpp:1:
> /home/mace/gpk/DOWNLOADS/shedskin-0.0.28/lib/builtin.hpp:156: error:
‘gc_allocator’ was not declared in this scope
> ...
What version of the product are you using? On what operating system?
shedskin 0.0.28
xubuntu 8.04
Please provide any additional information below.
All I really need is a little documentation on what libraries
are needed. Ideally, the installer would check to make sure
they exist.
Original issue reported on code.google.com by [email protected]
on 29 Jul 2008 at 11:26
# What happens:
Apparently shedskin can't find find the standard python module "atexit".
# Steps to reproduce:
1. Download fabricate from http://code.google.com/p/fabricate/
2. Place fabricate.py in the same folder as shedskin.py
3. ./shedskin.py fabricate.py
# Specifics:
Shedskin SVN revision 958
Fabricate SVN revision 48
Mac OSX 1.5.8 default Python install
Original issue reported on code.google.com by [email protected]
on 14 Sep 2009 at 10:00
What steps will reproduce the problem?
1. presence of c:/mingw on Windows XP Pro
2. shedskin test.py
3.
What is the expected output? What do you see instead?
... *ERROR* please rename or remove c:/mingw, as it conflicts with Shed Skin
What version of the product are you using? On what operating system?
2.0 or shedskin-read-only checkout. Windows XP Pro
Please provide any additional information below.
User should not have to uninstall a perfectly good mingw compiler. Just
check that it's not currently on the path.
Patch against shedskin-read-only is attached. [Works for me]
Original issue reported on code.google.com by [email protected]
on 21 Oct 2009 at 7:45
Attachments:
Hi,
here's what the dict method setdefault does:
def dict_setdefault(D, k, d):
#D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
r = D.get(k,d)
if k not in D:
D[k] = d
return r
btw, here is another example for shedskin:
http://rene.f0o.com/~rene/stuff/spacial_hash/hashmap.py
I converted the code from here so that it works with shedskin:
http://entitycrisis.blogspot.com/2007/11/spatial-hashing.html
cheers,
Original issue reported on code.google.com by [email protected]
on 12 Oct 2009 at 3:45
I noticed a lack of an operator module, so I decided to write a basic
one...
def add(a, b):
return a + b
def sub(a, b):
return a - b
def mul(a, b):
return a * b
def div(a, b):
return a / b
def floordiv(a, b):
return int(a / b)
def truediv(a, b):
# no easy way to implement truediv in 2.6.
return a.__truediv__(b)
def and_(a, b):
return a and b
def or_(a, b):
return a or b
def not_(a):
return not a
def inv_(a, b):
return ~a
__add__ = add
__sub__ = sub
__mul__ = mul
__div__ = div
__floordiv__ = floordiv
__truediv__ = truediv
__and__ = and_
__or__ = or_
__not__ = not_
__inv__ = inv_
I got an error while trying to compile it though.
thomas@kamikaze:~/shedskin/lib$ python ../ss.py operator.py
*** SHED SKIN Python-to-C++ Compiler 0.2 ***
Copyright 2005-2009 Mark Dufour; License GNU GPL version 3 (See LICENSE)
Traceback (most recent call last):
File "../ss.py", line 433, in <module>
main()
File "../ss.py", line 428, in main
analysis(name)
File "../ss.py", line 51, in analysis
getgx().main_module = parse_module(getgx().main_mod, ast)
File "/home/thomas/shedskin/graph.py", line 1428, in parse_module
mv.dispatch(mod.ast)
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 248, in visitModule
self.visit(n)
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 384, in visitFrom
mod = self.importmodules(node.modname, node, True)
File "/home/thomas/shedskin/graph.py", line 360, in importmodules
mod = self.importmodule(subname, subname, node, fake)
File "/home/thomas/shedskin/graph.py", line 367, in importmodule
mod = self.analyzeModule(name, pseudonym, node, fake)
File "/home/thomas/shedskin/graph.py", line 421, in analyzeModule
mod = parse_module(name, None, getmv().module, node)
File "/home/thomas/shedskin/graph.py", line 1428, in parse_module
mv.dispatch(mod.ast)
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 242, in visitModule
self.visit(Class(dummy, [], None, Pass()))
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 1166, in visitClass
if not getmv().module.builtin and not node in getmv().classnodes:
AttributeError: moduleVisitor instance has no attribute 'classnodes'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 39,
in apport_excepthook
from apport.packaging_impl import impl as packaging
File "/usr/lib/python2.6/dist-packages/apport/__init__.py", line 1, in
<module>
from apport.report import Report
File "/usr/lib/python2.6/dist-packages/apport/report.py", line 14, in
<module>
import subprocess, tempfile, os.path, urllib, re, pwd, grp, os, sys
File "/usr/lib/python2.6/subprocess.py", line 430, in <module>
import pickle
File "/usr/lib/python2.6/pickle.py", line 827, in <module>
class Unpickler:
File "/usr/lib/python2.6/pickle.py", line 957, in Unpickler
def load_binfloat(self, unpack=struct.unpack):
AttributeError: 'module' object has no attribute 'unpack'
Original exception was:
Traceback (most recent call last):
File "../ss.py", line 433, in <module>
main()
File "../ss.py", line 428, in main
analysis(name)
File "../ss.py", line 51, in analysis
getgx().main_module = parse_module(getgx().main_mod, ast)
File "/home/thomas/shedskin/graph.py", line 1428, in parse_module
mv.dispatch(mod.ast)
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 248, in visitModule
self.visit(n)
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 384, in visitFrom
mod = self.importmodules(node.modname, node, True)
File "/home/thomas/shedskin/graph.py", line 360, in importmodules
mod = self.importmodule(subname, subname, node, fake)
File "/home/thomas/shedskin/graph.py", line 367, in importmodule
mod = self.analyzeModule(name, pseudonym, node, fake)
File "/home/thomas/shedskin/graph.py", line 421, in analyzeModule
mod = parse_module(name, None, getmv().module, node)
File "/home/thomas/shedskin/graph.py", line 1428, in parse_module
mv.dispatch(mod.ast)
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 242, in visitModule
self.visit(Class(dummy, [], None, Pass()))
File "/home/thomas/shedskin/graph.py", line 54, in dispatch
ASTVisitor.dispatch(self, node, *args)
File "/usr/lib/python2.6/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/home/thomas/shedskin/graph.py", line 1166, in visitClass
if not getmv().module.builtin and not node in getmv().classnodes:
AttributeError: moduleVisitor instance has no attribute 'classnodes'
Original issue reported on code.google.com by [email protected]
on 8 Jan 2010 at 7:06
This patch let me run 'make' in OSX (Leopard + MacPorts)
(needs boehmgc and pcre)
Original issue reported on code.google.com by matteo.bertini
on 24 Apr 2008 at 11:08
Attachments:
Hi,
I have a module (basedados.py) that starts as:
"""
#-*- coding: iso-8859-15 -*-
import ConfigParser
import psycopg2
"""
It runs fine in Python, as stand-alone or when called from other modules.
If I try:
$ shedskin basedados
*** SHED SKIN Python-to-C++ Compiler 0.1.1 ***
Copyright 2005-2009 Mark Dufour; License GNU GPL version 3 (See LICENSE)
*ERROR* basedados.py:11: cannot locate module: psycopg2
Even if I remove every line from the module except the 'import psycopg2'
statement, the error is the same.
I'm using Slackware Linux 12.1, python 2.5.2 and shedskin 0.1.1
Original issue reported on code.google.com by [email protected]
on 9 Jul 2009 at 2:09
[deleted issue]
What steps will reproduce the problem?
1. Run the attached file "test.py" with python. It prints "0" or "100"
2. Generate a C++ file with Shedskin. "shedskin test.py" It works
3. Try to compile the resulting file "make". It doesn't compile.
What is the expected output? What do you see instead?
The included g++ throws out various type errors in builtin.hpp.
What version of the product are you using? On what operating system?
Shedskin 0.2 on Windows.
Please provide any additional information below.
The type inference seems to fail only when function objects are stored in
containers. (Things works as expected when function objects are stored in
variables.)
Original issue reported on code.google.com by seun.osewa
on 31 Jul 2009 at 12:08
Attachments:
What steps will reproduce the problem?
1. shedskin ftplib.py
What is the expected output? What do you see instead?
expected success, saw:
dbm@zareason /home/dbm/bench/uploadSirikata> shedskin ftplib.py
*** SHED SKIN Python-to-C++ Compiler 0.2 ***
Copyright 2005-2009 Mark Dufour; License GNU GPL version 3 (See LICENSE)
[iterative type analysis..]
******
iterations: 6 templates: 2098
[generating c++ code..]
Traceback (most recent call last):
File "/usr/lib/shedskin/bin/ss.py", line 433, in <module>
main()
File "/usr/lib/shedskin/bin/ss.py", line 428, in main
analysis(name)
File "/usr/lib/shedskin/bin/ss.py", line 149, in analysis
generate_code()
File "/usr/lib/shedskin/bin/ss.py", line 285, in generate_code
walk(module.ast, gv)
File "/usr/lib/python2.5/compiler/visitor.py", line 106, in walk
walker.preorder(tree, visitor)
File "/usr/lib/python2.5/compiler/visitor.py", line 63, in preorder
self.dispatch(tree, *args) # XXX *args make sense?
File "/usr/lib/python2.5/compiler/visitor.py", line 57, in dispatch
return meth(node, *args)
File "/usr/lib/shedskin/bin/cpp.py", line 500, in visitModule
self.module_cpp(node)
File "/usr/lib/shedskin/bin/cpp.py", line 411, in module_cpp
self.class_cpp(child)
File "/usr/lib/shedskin/bin/cpp.py", line 663, in class_cpp
if getgx().merged_inh[var]:
KeyError: (static class Error, '__eq__')
dbm@zareason /home/dbm/bench/uploadSirikata>
What version of the product are you using? On what operating system?
0.2, ubuntu 8.04
Please provide any additional information below.
this is a modified version of Python2.5 ftplib.py -- it works in pure python
Original issue reported on code.google.com by [email protected]
on 7 Aug 2009 at 2:27
Attachments:
ben@bds2:/tmp$ shedskin dxfpurgeblocks
*** SHED SKIN Python-to-C++ Compiler 0.1 ***
Copyright 2005-2008 Mark Dufour; License GNU GPL version 3 (See LICENSE)
[iterative type analysis..]
***
iterations: 3 templates: 312
[generating c++ code..]
ben@bds2:/tmp$ make
g++ -O2 -pipe -Wno-deprecated -I. -I/home/ben/shedskin/shedskin-0.1/lib
/home/ben/shedskin/shedskin-0.1/lib/stat.cpp
/home/ben/shedskin/shedskin-0.1/lib/sys.cpp
/home/ben/shedskin/shedskin-0.1/lib/builtin.cpp dxfpurgeblocks.cpp
/home/ben/shedskin/shedskin-0.1/lib/os/__init__.cpp
/home/ben/shedskin/shedskin-0.1/lib/os/path.cpp
/home/ben/shedskin/shedskin-0.1/lib/re.cpp -lgc -lpcre -lutil -o
dxfpurgeblocks
dxfpurgeblocks.cpp: In function ‘void __dxfpurgeblocks__::__init()’:
dxfpurgeblocks.cpp:216: error: statement cannot resolve address of
overloaded function
/home/ben/shedskin/shedskin-0.1/lib/os/__init__.cpp: In function ‘int
__os__::tcgetpgrp(int)’:
/home/ben/shedskin/shedskin-0.1/lib/os/__init__.cpp:630: warning:
converting to non-pointer type ‘int’ from NULL
make: *** [dxfpurgeblocks] Error 1
As you can see, shedskin completed without error. The resulting code
failed to compile. I fixed this by changing f->close to f->close() in the
generated dxfpurgeblocks.cpp.
Original issue reported on code.google.com by [email protected]
on 11 Apr 2009 at 1:58
By the way after GHOP...
When i try to access to non-existence index in list:
Python return: IndexError: list index out of range
SS return: make: *** [run] Segmentation fault
Test program is attached.
Original issue reported on code.google.com by [email protected]
on 17 Feb 2008 at 6:32
Attachments:
Apologies in advance if this is my ignorance! And thank you for producing
such a great product.
I came across this problem trying to solve problem 234 of the euler
project. The issue seems to be one of converting the python "long" type
into a C++ type that will handle very large integers.
What steps will reproduce the problem?
I created the following code in python:
************************************************
from time import time
def isPrime(n):
"""tests the primality of n the hard way (instead of sympy's
isprime)"""
if n==1:
return 0
elif n<=3:
return 1
if n%2==0:
return 0
for i in range(3,int(n**(0.5))+1,2):
if n%i==0:
return 0
return 1
startTime=time()
myN= 1000000000L #probably need SWIG/shed skin to do this...
i=0L
myPs=[2L]
for i in range(3,int(myN**0.5)+1,2):
if isPrime(i):
myPs.append(i)
i+=2
while not isPrime(i):
i+=2
myPs.append(i)
print "Primes generated up to",max(myPs)
mySD=0L
i=0L
k=0L
lps=0L
ups=0L
while 1:
lps=myPs[i]
ups=myPs[i+1]
for k in xrange(lps**2+1,ups**2):
if k>myN: break
divs=0
if k%lps==0: divs+=1
if k%ups==0: divs+=1
if divs==1: mySD+=k
if k>myN: break
i+=1
print "the sum of semidivs not exceeding",myN,"is",mySD
finishTime=time()
print "time taken: %f" %(finishTime-startTime)
*****************************************************
For myN=1000000L it seems to work fine (answer agrees with python, and runs
in a tenth of the time)
For myN=10000000L it produces a negative answer for a sum of large positive
numbers, without producing any errors or warnings, suggesting that the
integer has "ticked over" to a negative number. Similar results up to
myN=1000000000L. The expected output is a large positive integer.
For myN=999966663333L it produces the error in the title.
What version of the product are you using? On what operating system?
I'm running Skin Shed 0.1 (downloaded 3 Mar 2009) with Windows XP.
Please provide any additional information below.
many thanks
Original issue reported on code.google.com by [email protected]
on 3 Mar 2009 at 7:34
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.