[zeromq-dev] czmq python binding Zpoller

Johan Philips johan.philips at kuleuven.be
Wed Nov 4 21:53:42 CET 2015



On 2015-11-04 20:38, Arnaud Loonstra wrote:
> On 2015-11-03 22:55, Johan Philips wrote:
>> On 2015-11-03 19:31, Arnaud Loonstra wrote:
>>> I think you are right. Have you tried removing index().
>>
>> Yes and that silences the error but how can I add 2 sockets to the
>> poller? Is the only way by using the 'add' method?
>>
>> In zpoller (the C version) you could stack them in the constructor.
>> i.e.
>> zpoller_new(socket1, socket2, NULL)
>>
>> In python this results in:
>>
>> Traceback (most recent call last):
>>     File "zyre_test.py", line 12, in <module>
>>       poller = Zpoller(n1,n2,None)
>>     File "/home/jphilips/workspace/czmq/bindings/python/czmq.py", line
>> 1781, in __init__
>>       assert(len(args) == 2)
>> AssertionError
>> Exception AttributeError: "'Zpoller' object has no attribute
>> 'allow_destruct'" in <bound method Zpoller.__del__ of <czmq.Zpoller
>> object at 0x7f53f7a6d590>> ignored
>
> Ah I understand it now. You get an assertion error in the constructor
> before the
> allow_destruct bool can be set. So in the destructor you get another
> error because the
> allow_destruct isn't set. So the first error is a bug, the second can
> be blamed on python
> allowing dynamic types. We could prevent it by assigning allow_destruct
> earlier but it
> shouldn't be a problem. I think it is fixed here
> https://github.com/zeromq/zproject/pull/271

I've pulled that code before but the assertion of 2 arguments is, in my 
opinion, a "bug" because we want the constructor to be variadic, right?

>
> The binding for czmq is updated as well. Just pull from the latest
> master.
>
> Rg,
>
> Arnaud
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list