poppopjmp / shedskin

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

Dynamic (sub)type, but both the same. #169

Closed GoogleCodeExporter closed 8 years ago

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

What is the expected output? What do you see instead?
I expect this to work the same as if line #74 of actor.py was commented out.  
That is compile, make and run actor, and get some simple output.

There are warnings as a result of shedskin, and make errors out.

What version of the product are you using? On what operating system?
0.9.2
on Windows.

Please provide any additional information below.
Actor and Port, both import each other, because there is a reference stored in 
each to the other.  I am new to Python, and this is the simplest way I could 
think of to do this (that is if either object is used, to be able to get to the 
partner object).  Could this work in shedskin, or should I be looking for a 
different implementation.
Note: The code is simplified to present the issue. The orginal version used 
line #48 instead, with the same result.

Thank you,
Mike Badamo

Original issue reported on code.google.com by badamom...@gmail.com on 31 May 2012 at 7:57

Attachments:

GoogleCodeExporter commented 8 years ago
thanks a lot for reporting! I see the problem.... will have a look this weekend.

Original comment by mark.duf...@gmail.com on 1 Jun 2012 at 1:24

GoogleCodeExporter commented 8 years ago
no, couldn't resist.. fixed the problem in git. interestingly, the main module 
was not added to the internal cache, leading to a re-parsing of the main module 
at the 'import Actor' in port.py, in turn leading to two different Actor 
classes and hence a 'dynamic type'. now your program compiles fine here. thanks 
again for reporting!

btw you probably don't need as much code under 'if __name__ == '__main__'' in 
port.py, because some of these calls are also done in actor.py. if anything is 
(indirectly) called from anywhere, you usually shouldn't need an extra call.

please let me know if you run into anything else, and/or if your fully program 
might be interesting to add to shedskin/examples.

Original comment by mark.duf...@gmail.com on 1 Jun 2012 at 4:33

GoogleCodeExporter commented 8 years ago
Thanks Mark,
Well I did run into a couple more issues.
If you like I will post them on the Shedskin site, but here's a quick
summary.

1. There seems to be a problem with removing list objects while iteration
over the list, and there may also be an issue with removing an object in a
list when it happens to be the only one (although I'm not sure I've seen
either consistenlty).

2. It appears there is an issue with the translation of the str.split(sep)
function in the shedskin library.
If I look at the .cpp file, I see something like str->split(), but I
believe it should be <name of string object> -> split().

Let me know if you want me to supply example code for either.

I think I can put together an interesting example from what we're doing
here.
(After I get it all working).

Original comment by badamom...@gmail.com on 5 Jun 2012 at 7:25

GoogleCodeExporter commented 8 years ago
thanks! yes, please do send me example code, preferrably as separate new 
issues.. :-)

Original comment by mark.duf...@gmail.com on 5 Jun 2012 at 7:37