[zeromq-dev] zsock test hangs in pyczmq
Pieter Hintjens
ph at imatix.com
Sun Jun 15 14:53:48 CEST 2014
OK, I've fixed the problem: https://github.com/zeromq/czmq/pull/525
On Fri, Jun 13, 2014 at 8:14 PM, Michel Pelletier
<pelletier.michel at gmail.com> wrote:
>
>
>
> On Fri, Jun 13, 2014 at 11:08 AM, Pieter Hintjens <ph at imatix.com> wrote:
>>
>> On Fri, Jun 13, 2014 at 7:55 PM, Michel Pelletier
>> <pelletier.michel at gmail.com> wrote:
>>
>> > Some gdb adventures shows I was calling zsock_new with filename and
>> > line_nbr
>> > args defaulting to NULL and 0 out of sheer laziness.
>>
>> That should actually work... it's usually what you'd do in release
>> mode with all socket tracking switched off.
>
>
> Yeah that's what I was thinking when I wrote it. Python can't know how czmq
> was compiled with ZSOCK_NOCHECK unless I expose it and that sounded ugly to
> me, so instead I have:
>
> @cdef('zsock_t * zsock_new_ (int type, const char *filename, size_t
> line_nbr);')
> def new(type, filename=None, line_nbr=None):
> if filename is None:
> frame = inspect.stack()[1][0]
> info = inspect.getframeinfo(frame)
> filename = info.filename
> line_nbr = info.lineno
> return ffi.gc(C.zsock_new_(type, filename, line_nbr), destroy)
>
>
> Which sidesteps the issue by calling zsock_new_ directly with file and line
> information from the frame's caller. I don't think __FILE__ and __LINE__
> would be useful to a pyczmq user, as it would end up referencing a generated
> C file internal to CFFI.
>
> -Michel
>
> _______________________________________________
> 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