I found that the error was from type() in pyjs, not the method send() in
generator: type() of generator as a class member is not equal to as a
non-class value. I created a simple example showing the problem:
import pyjd # this is dummy in pyjs.
class GUI():
def onModuleLoad(self):
g=test_generator()
self.g=g
print 'g=%s, type(g)=%s' % (g, type(g))
print 'self.g=%s, type(self.g)=%s' % (self.g, type(self.g))
i=1
self.i=i
print 'i=%s, type(i)=%s' % (i, type(i))
print 'self.i=%s, type(self.i)=%s' % (self.i, type(self.i))
def test_generator():
yield 'the first yield in func_async1'
pyjd.setup('public/GUI.html')
gui = GUI()
gui.onModuleLoad()
pyjd.run()
The Pyjs execution result shows that type(g) is not equal to type(self.g).
I think that it is a bug:
g=function () {}, type(g)=class pyjslib.FunctionType
self.g=class g, type(self.g)=class test_generator.GUI
In case of an integer value (and types other than generator), type(self.i)
is equal to type(i):
i=1, type(i)=function(value, radix) {...}
self.i=1, type(self.i)=function(value, radix) {...}
This problem doesn't exist in Pyjd. As you can see that type(int) is not
int, but function() which is Pyjs implementation. I also found that Pyjs
generator is not directly using Javascript generator (maybe because of a
version problem). It seems that Pyjs implementation of type() of a
generator as class member has a bug not using a valid class member.
I don't know how to fix this problem. Anyone has an idea?
--
---
You received this message because you are subscribed to the Google Groups
"Pyjs.org Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.