cy99 / shedskin

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

Class variable initializer error for dict type #72

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
class variable initializer error for dict type. but declaration for dict 
type class var is right

details:

E:\test>cat testa.py
class bb():
  pass

class aa(object):
  class_dict_var={}
  class_int_var=0
  def __init__(self):
    print "init a"
    temp=[1,2]
    aa.class_dict_var.update({1:bb()})
    aa.class_int_var=2
    #for i in temp:
    #  print i
global_dict_var = {}

if __name__ == __main__:
  test=aa()
  global_dict_var.update({1:bb()})

E:\test>shedskin testa
*** SHED SKIN Python-to-C++ Compiler 0.5 ***
Copyright 2005-2010 Mark Dufour; License GNU GPL version 3 (See LICENSE)

[iterative type analysis..]
**
iterations: 2 templates: 58
[generating c++ code..]
*WARNING* testa.py:16: variable '__main__' has no type

E:\test>nmake /sc
testa.cpp
testa.cpp(45) : error C2469: 'new' : cannot allocate 'void' objects
testa.cpp(45) : error C2440: '=' : cannot convert from 'void *' 
to '__shedskin__::dict<K,V> *'
        with
        [
            K=__shedskin__::__ss_int,
            V=__testa__::bb *
        ]
        Conversion from 'void*' to pointer to non-'void' requires an 
explicit cast
builtin.cpp
re.cpp
NMAKE :  U1077: 'cl' : return code '0x2'
Stop.

Original issue reported on code.google.com by jason.mi...@gmail.com on 11 May 2010 at 1:43

GoogleCodeExporter commented 8 years ago
thanks also for this one ^^ I will look at it during my next round of bug 
fixes..

Original comment by mark.duf...@gmail.com on 11 May 2010 at 2:06

GoogleCodeExporter commented 8 years ago
okay, I fixed this and some related cases in SVN. thanks for triggering! please
verify..! does your whole program work now? and are you seeing a good speedup?

Original comment by mark.duf...@gmail.com on 23 May 2010 at 8:23

GoogleCodeExporter commented 8 years ago
Test passed!
The program works now, ~7x speedup, pretty :)
Great job!  keep going

Original comment by jason.mi...@gmail.com on 23 May 2010 at 10:53

GoogleCodeExporter commented 8 years ago
thanks again for reporting!! closing this one..

have you tried to profile the compiled program? (see the tutorial for this and 
other
performance tips) because, 7 times is not that much.. :D

Original comment by mark.duf...@gmail.com on 23 May 2010 at 11:03